Sunday, August 20, 2017

Reverse for 'password_reset_complete' not found

Hello friends,

I will appreciate it if you can help me resolve the following issue.

I am trying to use the Django built-in views for resetting passwords but get an error in the very end. I have done the following steps:
1. in URLs.py:

    url(r'^password_reset/$', auth_views.password_reset,{'email_template_name':'registration/password_reset_email.html','subject_template_name':'registration/password_reset_subject.txt','post_reset_redirect':'main:password_reset_done','from_email':'something@gmail.com',},name='password_reset'),
    url(r'^reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',auth_views.PasswordResetConfirmView.as_view(),{'success_url':'passwordresetcomplete'}, name='password_reset_confirm' ),
    url(r'^password_reset/done/$', auth_views.password_reset_done, {'template_name': 'registration/password_reset_done.html'}, name='password_reset_done'),
    url(r'^reset/confirm/done/$', auth_views.password_reset_complete, name='password_reset_complete'),

I also have added my custom html files in *appname/templates/registration/* the html files are:

password_reset_complete.html
password_reset_email.html
password_reset_confirm.html
password_reset_form.html
password_reset_done.html
password_reset_subject.txt


Now here is what happens: when I go to http://127.0.0.1:8000/password_reset/ it asks for an email address. after entering an email for a user it says we have sent you a link and I see the link in email. when I click on the link, a page opens and ask for a new password and a password confirmation. When I hit the submit button, I can see that the password is really changed but instead of being directed to an html page I get an error. Here it is

    NoReverseMatch at /reset/confirm/MQ/set-password/
    Reverse for 'password_reset_complete' not found. 'password_reset_complete' is not a valid view function or pattern name.
    Request Method:     POST
    Request URL:     http://127.0.0.1:8000/reset/confirm/MQ/set-password/
    Django Version:     1.11.2
    Exception Type:     NoReverseMatch
    Exception Value:     
    Reverse for 'password_reset_complete' not found. 'password_reset_complete' is not a valid view function or pattern name.
    Python Version:     2.7.12

Thanks for your help,


No comments:

Post a Comment