pythondjangodjango-authentication

Django Error - Reverse for 'password_reset_confirm' with arguments '()' and keyword arguments '


I am trying to create a reset password functionality in my application and added the following lines in my urls.py.

urls.py

url(r'^resetpassword/passwordsent/$', 'django.contrib.auth.views.password_reset_done', name='password_reset_done'),
    url(r'^resetpassword/$', 'django.contrib.auth.views.password_reset'),
    url(r'^reset/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm'),
    url(r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),

But when I enter my email id on reset password, it is showing an error which I am not able to understand. Reverse for 'password_reset_confirm' with arguments '()' and keyword arguments 'I have gone through some of the suggestions but none are working. Could anyone any help me with this error?

See the below image:

enter image description here

I


Solution

  • Django needs to know how to resolve the URL from the name used in the url template tag. You should add the name to this line:

     url(r'^reset/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm'),
    

    So it becomes:

     url(r'^reset/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm', name='password_reset_confirm'),
    

    See more about reverse resolution here:

    https://docs.djangoproject.com/en/1.8/topics/http/urls/#reverse-resolution-of-urls