2014-06-25 26 views
0

项目/ urls.pyNoReverseMatch HTML

(r'^notendur/', include('notendur.urls')), 

应用程序/ urls.py

url(r'^options/(?P<pk>[^/]+)/', 'options', name='options'), 

list.html

<form action="{% url "options" %}" method="post"> 

views.py

def options(request, pk): 
    return render_to_response(
     'file_view.html', 
     context_instance=RequestContext(request) 
     ) 

该错误在list.html中被捕获。你能发现有什么问题吗?我知道NoReverseMatch在这里是一个常见的错误,所以我一定要阅读以前的文章。我还没有找到我的错误的来源。

我想用这个代码做的是,当list.html中的表单被激活时,选项功能将用户带到file_view.html

回答

1

选项URL需要pk参数,因此您需要将其包含在url标记中。