我的URLconf包含以下模式:
url(r'^accounts/logout/$','django.contrib.auth.views.logout', name="logout"),
我一直在尝试使用URL标签在模板中进行反向操作,像这样:
<a href="{% url logout next_page=request.path %}">logout</a>
但我一直收到以下错误提示:
Reverse for 'logout' with arguments '()' and keyword arguments '{'next_page': u'/first-page/child/'}' not found
我认为django.contrib.auth.views.logout
应该带有一个选项next_page
参数。但是我肯定我错过了一些显而易见的东西,只是不确定是什么。