我正在尝试使用Django附带的密码重置设置,但文档并不是很好.我正在使用Django 1.0,我不断收到此错误:
Caught an exception while rendering: Reverse for 'mysite.django.contrib.auth.views.password_reset_confirm' with arguments '()' and keyword arguments ...
Run Code Online (Sandbox Code Playgroud)
在我的urlconf中我有这样的事情:
#django.contrib.auth.views
urlpatterns = patterns('django.contrib.auth.views',
(r'^password_reset/$', 'password_reset', {'template_name': 'accounts/registration/password_reset_form.html', 'email_template_name':'accounts/registration/password_reset_email.html', 'post_reset_redirect':'accounts/login/'}),
(r'^password_reset/done/$', 'password_reset_done', {'template_name': 'accounts/registration/password_reset_done.html'}),
(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'password_reset_confirm', {'template_name': 'accounts/registration/password_reset_confirm.html', 'post_reset_redirect':'accounts/login/', 'post_reset_redirect':'accounts/reset/done/'}),
(r'^reset/done/$', 'password_reset_complete', {'template_name': 'accounts/registration/password_reset_complete.html'}),
)
Run Code Online (Sandbox Code Playgroud)
问题似乎出现在这个文件中:
password_reset_email.html
Run Code Online (Sandbox Code Playgroud)
在第7行
{% url django.contrib.auth.views.password_reset_confirm uidb36=uid, token=token %}
Run Code Online (Sandbox Code Playgroud)
我不知道发生了什么,所以任何帮助都会受到赞赏.
谢谢
只是想发布我想出的解决方案。问题出在这一行:
{% url django.contrib.auth.views.password_reset_confirm uidb36=uid, token=token %}
Run Code Online (Sandbox Code Playgroud)
我也不是 100% 为什么,所以我只是硬编码了 url,如下所示:
http://mysite.com/accounts/reset/{{uid}}-{{token}}/
Run Code Online (Sandbox Code Playgroud)