I am following this blog to reset the user password in Django. It is working perfectly. But the problem is that I want to show my template instead of the Django admin panel when resetting the password or confirming the mail. How can I achieve it?
This is my urls.py file
url(r'^password_reset/$', password_reset , name='password_reset_reset1'),
url(r'^password_reset/done/$', password_reset_done, name='password_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})/$',
password_reset_confirm, name='password_reset_confirm'),
url(r'^reset/done/$', password_reset_complete, name='password_reset_complete'),
What step do I need to take for template and views> I have tried many and add some file like:
registration/password_reset_form.html
registration/password_reset_subject.txt
registration/password_reset_email.html
registration/password_reset_done.html
registration/password_reset_confirm.html
registration/password_reset_complete.html
But there is no effect> I just want to render my website template while resetting the password.
This is my directory structure:
├── backmyitem
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── feed
│ ├── admin.py
│ ├── apps.py
│ ├── forms.py
│ ├── __init__.py
│ ├── migrations
│ │ ├── 0001_initial.py
│ │ ├── 0002_auto_20180804_1610.py
│ │ ├── 0003_auto_20180805_0533.py
│ │ ├── 0004_claimform.py
│ │ ├── 0005_auto_20180807_1403.py
│ │ ├── 0006_auto_20180807_1840.py
│ │ ├── 0007_auto_20180809_0045.py
│ │ ├── 0008_auto_20180809_0126.py
│ │ ├── 0009_auto_20180809_0140.py
│ │ ├── 0010_report_item_owner.py
│ │ ├── 0011_usernotification.py
│ │ ├── 0012_auto_20180813_0051.py
│ │ ├── 0013_auto_20180815_0159.py
│ │ ├── __init__.py
│ ├── models.py
│ ├── templates
│ │ ├── feed
│ │ │ ├── base.html
│ │ │ ├── claimform_form.html
│ │ │ ├── detail.html
│ │ │ ├── footer.html
│ │ │ ├── form_template.html
│ │ │ ├── header.html
│ │ │ ├── index.html
│ │ │ ├── loggedin.html
│ │ │ ├── login_user.html
│ │ │ ├── notification.html
│ │ │ ├── profile.html
│ │ │ ├── report_item_confirm_delete.html
│ │ │ ├── report_item_form.html
│ │ │ ├── SignUp.html
│ │ │ └── usernotification_form.html
│ │ ├── notification
│ │ └── registration
│ │ ├── form_login_template.html
│ │ └── login.html
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── manage.py
└── myammaji
Thanks!
To override these templates, you will need to have an admin folder in your templates folder. If you do not have a templates folder, you can create it in the main project folder. To do so, you will have to change the project's settings.py . Find the TEMPLATES section and modify accordingly.
manage.py changepassword *username* offers a method of changing a user's password from the command line.
In your settings.py make sure your TEMPLATES settings is equal to the following
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},]
the most important part here is the DIRS
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With