Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 915
python Avatar asked Oct 18 '15 06:10

python


1 Answers

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

like image 101
Will Hogan Avatar answered Oct 21 '22 23:10

Will Hogan