, 'django.contrib.auth.views.password_reset_confirm', name="reset_pass...">

Callback error

If I have a url:

url(r'^reset/(?P<uid>\w+)/(?P<token>\w+)/$', 'django.contrib.auth.views.password_reset_confirm', name="reset_password") 

and URL tag, for example:

 {% url 'reset_password' uid=uid token=token %} 

Why am I getting this error when I try to display the page that contains the tag:

 Reverse for 'reset_password' with arguments '()' and keyword arguments not found 

The imide and token are valid strings.

+6
source share
2 answers

I would say that your uid or your token has non-alphanumeric char such as "-" or ".". So I would try changing urls.py to:

 url(r'^reset/(?P<uid>.+)/(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm', name="reset_password") 

I do not like to use. in regular expression, but if you have no choice ...

+1
source

try the following:

1. always try to skip your URL as 'app_name:reset_password' with only the addition

app_name='your app name' at the beginning of your urls.py file this will help you in the future if you are processing several applications in the same project when your html names conflict at the same time

2.Try these changes in your urls, since you are using django auth views and its password is reset, you need to specify the redirect url and after resetting the password, just to add

 {'post_reset_redirect':'<app_name>:<url_name>'} url(r'^reset/(?P<uid>[-\w]+)/(?P<token>[-\w]+)/$', 'django.contrib.auth.views.password_reset_confirm', {'post_reset_redirect':'<your redirection url after reset password'},name="reset_password")} 

And yes, please check the variables in the same way as "uid", because since django's own function can be its own variable name, try "uidb64"

0
source

All Articles