Django内置密码重置,我的网址有什么问题?

时间:2014-03-11 02:33:36

标签: django

每个人似乎都指向本指南,以便轻松插入密码重置: http://garmoncheg.blogspot.com.au/2012/07/django-resetting-passwords-with.html

所以从我读过的内容来看,如果你想让它发挥作用,那么网址就是你所需要的4个网址:

urlpatterns = patterns('',
 . . . 
    url(r'^user/password/reset/$', 'django.contrib.auth.views.password_reset', {'post_reset_redirect' : '/user/password/reset/done/'}, name="password_reset"),
        (r'^user/password/reset/done/$', 'django.contrib.auth.views.password_reset_done'),
        (r'^user/password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm', {'post_reset_redirect' : '/user/password/done/'}),
        (r'^user/password/done/$', 'django.contrib.auth.views.password_reset_complete'),
 . . .
)

这似乎不起作用,因为我仍然得到了臭名昭着的

  

NoReverseMatch at / user / password / reset /

用这个:

Reverse for 'password_reset_confirm' with arguments '()' and keyword arguments '{u'uidb64': 'NA', u'token': u'3ps-749165b2b39d4168f97f'}' not found. 1 pattern(s) tried: ['user/password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$']

指南中是否有某些东西已经折旧了我将链接放在顶部?我应该将任何内容导入urls.py文件吗?

1 个答案:

答案 0 :(得分:4)

您的网址格式正在使用uidb36,但您的反向通话正在寻找uidb64。有关1.6中此更改的详细信息,请参阅the documentation