第二次进行python用户注册登录等功能的编写,收获颇多,对django认识更多。
urls.py
Read more...
#passwd reset
url(r'^resetpassword/$','django.contrib.auth.views.password_reset',{'template_name':'account/resetpassword.html','email_template_name':'account/password_reset_mail.html','subject_template_name':'accouts/password_reset_subject.txt','post_reset_redirect':'/',}),
#密码重置链接
url(r'^reset/(?P[0-9A-Za-z]+)-(?P.+)/$', 'django.contrib.auth.views.password_reset_confirm', {'template_name' : 'account/password_reset.html','post_reset_redirect': '/account/logout/' }),
#passwd change
开始没有写密码重置链接的url配置,报错:
Exception Value: Caught NoReverseMatch while rendering: Reverse for'django.contrib.auth.views.password_reset_confirm' with arguments '()'and keyword arguments '{'uidb36': '4', 'token':'36x-7d6e7419555fda3bc140'}' not found.
参数的详细讲解:https://docs.djangoproject.com/en/1.4/topics/auth/
registration/password_reset_email.html可以直接复制django自带的那个文件,文件地址:
/usr/local/lib/python2.6/dist-packages/django/contrib/admin/templates/registration/password_reset_email.html