3
我必须错过一些愚蠢的东西。我有一个模板中的{%url%},其中的操作来自另一个应用程序。它不工作,但我不知道如果从其他应用程序使用视图功能有什么不同,或者我只是在做一些愚蠢的事情。从另一个应用程序django模板url
呼叫/模板/电话/ file.html
<form action="{% url 'upload_image' %}"></form>
图片/ urls.py
from .views import PictureList, PictureCreate, PictureDetail, PictureUpdate, PictureDelete, upload_image
...
url(r'^upload_image/$', upload_image, name='upload_image'),
...
图片/ view.py
def upload_image(request):
print 'IN IMAGE UPLOAD'
print request
所有我曾经得到的是:
NoReverseMatch at /call/4/
Reverse for 'upload_image' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
该文件是故意命名为'url.py'还是它是一个错字? – alecxe 2014-11-08 02:38:59
这是一个错字...现在修复了 – brechmos 2014-11-08 02:44:37
如果您使用名称空间版本“{%url”图片:upload_image'%}'而不是? – alecxe 2014-11-08 02:48:00