【发布时间】:2011-04-23 12:15:21
【问题描述】:
我正在尝试在 Django 中使用通用 PasswordChangeForm 和 password_change 视图,但遇到了 NoReverseMatch 错误。
这是我的 urls.py:
(r'^change_pass/','django.contrib.auth.views.password_change', {'post_change_redirect':'/home'}),
然后,我尝试从模板中调用以下内容:
<form action="{% url django.contrib.auth.views.password_change post_change_redirect="/home/userpage" %}" method="POST">
我明白了
渲染时捕获 NoReverseMatch:“django.contrib.auth.views.password_change”的反向参数“()”和关键字参数“{'post_change_redirect': u'/home/userpage'}”未找到。
我做错了什么?我想如果在 urls.py 中声明了一个可选变量,那么您可以在调用时通过将其指定为命名参数来覆盖它。谢谢!
【问题讨论】:
标签: django django-templates django-urls