Password reset custom view

51 views
Skip to first unread message

sarfaraz ahmed

unread,
Apr 9, 2017, 1:27:20 AM4/9/17
to django...@googlegroups.com

urlpatterns =   [
                url(r'^login/',login,name='login'),
                url(r'^auth_view/',auth_view, name='auth_view'),
                url(r'^signup_success/',signup_success,name='signup_success'),
                url(r'^signup/',signup,name='signup'),
                url(r'^logout/',logout,name='logout'),
                url(r'^signup_confirm/(?P<activation_key>\w+)',signup_confirm,name='signup_confirm'),
                url(r'^account_info/',account_info,name='account_info'),
                url(r'^user_profile/',user_profile,name='user_profile'),
                url(r'^address/',address,name='address'),
                url(r'^change_password/',change_password,name='change_password'),
                url(r'^add_address/',add_address,name='add_address'),
                url(r'^edit_address/(?P<id>\d+)',edit_address,name='edit_address'),
                url(r'^delete_address/(?P<id>\d+)',delete_address,name='delete_address'),
                url(r'^change_password/',change_password,name='change_password'),
                url(r'^email_test/',email_test,name='email_test'),
                url(r'^password_reset/$', auth_views.password_reset ,{'template_name':'user_management/password_reset.html','email_template_name': 'user_management/password_reset_email.html'}),
                url(r'^password_reset/done/$', auth_views.password_reset_done,  {'template_name': 'user_management/password_reset_done.html','post_reset_redirect':'password_reset_confirm'}),
                url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
                auth_views.password_reset_confirm, name='password_reset_confirm'),
                url(r'^reset/done/$', auth_views.password_reset_complete, {'template_name':'user_management/password_reset_complete.html'},name='password_reset_complete'),
                ]


------------------------------------------------------------------------------------------------------------------------------------------------
ERROR
------------------------------------------------------------------------------------------------------------------------------------------------
Request Method: GET Request URL: http://127.0.0.1:8000/password_reset/ Django Version: 1.10.5 Exception Type: NoReverseMatch Exception Value:

Reverse for 'password_reset_done' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

Exception Location: C:\Python27\lib\site-packages\django-1.10.5-py2.7.egg\django\urls\resolvers.py in _reverse_with_prefix, line 392 Python Executable: C:\Python27\python.exe Python Version: 2.7.9

Please help


--
Thanks with regards,
Sarfaraz Ahmed



--
Thanks with regards,
Sarfaraz Ahmed


ludovic coues

unread,
Apr 9, 2017, 8:51:01 AM4/9/17
to django...@googlegroups.com
Do you mind to share your full urls.py file and the full traceback ?

If I have to take a guess with the informations you have have shared,
I would say the line

url(r'^password_reset/done/$', auth_views.password_reset_done,
{'template_name':
'user_management/password_reset_done.html','post_reset_redirect':'password_reset_confirm'}),

is missing an argument name="password_reset_done".
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEPJdiyuqajjWMq2kk9FTVXhY7erWqeDG18qL6LFQeV8LQBTKA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Ludovic Coues
+33 6 14 87 43 42

sarfaraz ahmed

unread,
Apr 9, 2017, 4:03:45 PM4/9/17
to django...@googlegroups.com
This is full url.py... i have made all templates.... I also used name="password_reset_done". But still get same error




--

Cordialement, Ludovic Coues
+33 6 14 87 43 42

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

For more options, visit https://groups.google.com/d/optout.



--

sarfaraz ahmed

unread,
Apr 9, 2017, 4:13:25 PM4/9/17
to django...@googlegroups.com
Here is full error message
------------------------------------------------------------------------------------

NoReverseMatch at /password_reset/

Reverse for 'password_reset_done' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Request Method: GET Request URL: http://127.0.0.1:8000/password_reset/ Django Version: 1.10.5 Exception Type: NoReverseMatch Exception Value:
Reverse for 'password_reset_done' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Exception Location: C:\Python27\lib\site-packages\django-1.10.5-py2.7.egg\django\urls\resolvers.py in _reverse_with_prefix, line 392 Python Executable: C:\Python27\python.exe Python Version: 2.7.9 Python Path:
['G:\\DJANGO_Project\\project1',
 'C:\\Python27\\lib\\site-packages\\django_extensions-1.4.9-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\six-1.9.0-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\werkzeug-0.9.6-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\django_cron-0.3.5-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\django_common_helpers-0.6.3-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\south-1.0.2-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\django_crontab-0.6.0-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\django_kronos-0.6-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\python_crontab-1.9.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\django_chronograph-0.3.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\python_dateutil-1.5-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\crontab-0.20.2-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\django_chroniker-0.6.8-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\psutil-2.2.0-py2.7-win32.egg',
 'C:\\Python27\\lib\\site-packages\\celery-3.1.17-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\kombu-3.0.24-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\billiard-3.3.0.19-py2.7-win32.egg',
 'C:\\Python27\\lib\\site-packages\\pytz-2014.10-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\amqp-1.4.6-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\anyjson-0.3.3-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\django_celery-3.1.16-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\django_kombu-0.9.4-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\django_windows_tools-0.1.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\elasticsearch-1.3.0-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\urllib3-1.10.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\beautifulsoup-3.2.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\xmlutils-1.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\pillow-2.9.0-py2.7-win32.egg',
 'C:\\Python27\\lib\\site-packages\\requests-2.7.0-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\openpyxl-2.3.4-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\et_xmlfile-1.0.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\jdcal-1.2-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\xlrd-0.9.4-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\webcolors-1.5-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\bpython-0.15-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\greenlet-0.4.9-py2.7-win32.egg',
 'C:\\Python27\\lib\\site-packages\\curtsies-0.2.6-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\pygments-2.1.3-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\wcwidth-0.1.6-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\blessings-1.6-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\dnspython-1.14.0-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\django-1.10.5-py2.7.egg',
 'C:\\Windows\\system32\\python27.zip',
 'C:\\Python27\\DLLs',
 'C:\\Python27\\lib',
 'C:\\Python27\\lib\\plat-win',
 'C:\\Python27\\lib\\lib-tk',
 'C:\\Python27',
 'C:\\Python27\\lib\\site-packages',
 'C:\\Python27\\lib\\site-packages\\win32',
 'C:\\Python27\\lib\\site-packages\\win32\\lib',
 'C:\\Python27\\lib\\site-packages\\Pythonwin']
Server time: Sun, 9 Apr 2017 20:09:38 +0000

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
URL.py


from django.conf.urls import url,include

from django.conf.urls import url
from django.conf.urls import include


from . import views
from views import *


from django.contrib.auth import views as auth_views


app_name ="user_management"


urlpatterns =   [
                url(r'^login/',login,name='login'),
                url(r'^auth_view/',auth_view, name='auth_view'),
                url(r'^signup_success/',signup_success,name='signup_success'),
                url(r'^signup/',signup,name='signup'),
                url(r'^logout/',logout,name='logout'),
                url(r'^signup_confirm/(?P<activation_key>\w+)',signup_confirm,name='signup_confirm'),
                url(r'^account_info/',account_info,name='account_info'),
                url(r'^user_profile/',user_profile,name='user_profile'),
                url(r'^address/',address,name='address'),
                url(r'^change_password/',change_password,name='change_password'),
                url(r'^add_address/',add_address,name='add_address'),
                url(r'^edit_address/(?P<id>\d+)',edit_address,name='edit_address'),
                url(r'^delete_address/(?P<id>\d+)',delete_address,name='delete_address'),
                url(r'^change_password/',change_password,name='change_password'),
                url(r'^email_test/',email_test,name='email_test'),
                url(r'^password_reset/$', auth_views.password_reset ,{'template_name':'user_management/password_reset.html','email_template_name': 'user_management/password_reset_email.html'}),
               # url(r'^password_reset/done/$', auth_views.password_reset_done,  {'template_name': 'user_management/password_reset_done.html','post_reset_redirect':'/reset/done/'}),
                #url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
                #auth_views.password_reset_confirm, {'post_reset_redirect':'password_reset_confirm'}, name='password_reset_confirm'),
                #url(r'^reset/done/$', auth_views.password_reset_complete, {'template_name':'user_management/password_reset_complete.html'},name='password_reset_complete'),
                #
               
                ]

Please help I m stuck


Matthew Pava

unread,
Apr 9, 2017, 4:20:36 PM4/9/17
to django...@googlegroups.com

As another user mentioned, you did not specify the name keyword argument for password_reset_done.  You also have the line commented out in your urls file.

 

# url(r'^password_reset/done/$', auth_views.password_reset_done,  {'template_name': 'user_management/password_reset_done.html','post_reset_redirect':'/reset/done/'}),

 

should become

 

url(r'^password_reset/done/$', auth_views.password_reset_done,  {'template_name': 'user_management/password_reset_done.html','post_reset_redirect':'/reset/done/'}, name='password_reset_done'),

--

You received this message because you are subscribed to the Google Groups "Django users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.


To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

sarfaraz ahmed

unread,
Apr 10, 2017, 1:12:36 AM4/10/17
to django...@googlegroups.com
I fixed that i am facing new error. Posted as new problem

regards,
Sarfaraz Ahmed

--

To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.


To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

For more options, visit https://groups.google.com/d/optout.

sarfaraz ahmed

unread,
Apr 10, 2017, 1:14:07 AM4/10/17
to django...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages