如何覆盖我的模板而不是django管理面板来重置密码? [英] How to override my template instead of django admin panel for reset password?
问题描述
我正在关注此博客以重置Django中的用户密码。运行良好。但是问题是我想在重置密码或确认邮件时显示模板而不是Django管理面板。我如何实现?
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?
这是我的urls.py文件
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
但没有效果>我只想
这是我的目录结构:
├── 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
谢谢!
推荐答案
转到Django管理员注册目录
Go to the Django admin registration directory
/home/username/Desktop/Project_folder/virtual_env_name/lib/python3.6/site-packages/django/contrib/admin/templates
现在打开password_reset_form.html并替换
Now open the password_reset_form.html and replace the
{% extends "admin/base_site.html" %}
要扩展。就我而言,我执行以下操作
from the template, you want to extend. In my case, I do the following
{% extends "feed/base.html" %}
feed:应用名称
base.html:基本文件
feed: app name base.html: base file
这篇关于如何覆盖我的模板而不是django管理面板来重置密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!