Hi
I would require some help.
Im new to django and Im building website, that will use the Django authorization management.
I have created an app accounts is to manage everything related to the users.
Inside of this app I have a folder
templates\registration
Inside of that i have templates:
login.html
password_change_form.html
password_change_done.html
password_reset_form.html
password_reset_done.html
The urls.py in the accounts app includes:
urlpatterns = [
path(‘accounts/’, include(“django.contrib.auth.urls”)),
]
and the main urls.py
urlpatterns = [
path(‘’, include(‘accounts.urls’)),
path(‘register/’, views.register, name=“register”),
path(‘admin/’, admin.site.urls),
]
What is bodering me is that the login.html is rendered normally from the custom template, while the password_change and password_reset forms are ignored and the page redirects to the default admin page.
Any ideas what I’m missing?
Don’t know if you’ve found your answer yet or not, but a quick search of the documentation leads me to believe that you need to override the individual URLs for the password change process to specify that your own templates are to be used.
Thx for the tip. It does kind a work with a custom individual URL, still after the form is submitted form the redirection goes to the admin password_change/done page.
According to this tutorial you should be able to simply replace the templates with custom ones with no additional URLs specified.
One of the key items with it working the way described is that the templates must reside in a directory named “registration”, and you must make the settings file change to include your project-level “templates” directory in the DIRS option. Once this is done, then it should locate your registration pages before the app-based templates are found.
I had the same problem, and it solved by putting the app that handle authentication (in your case “accounts”) at the beginning (first place) of the INSTALLED_APPS list in the setting.py file. As you point out custom login file page can be called from the inside of the app templates/registration folder and you may want to keep all your files in the same place.
customized template password_reset_form.html was placed in directory templates/registration where template is located in the root directory like project folder and app folder accounts
eu só renomeei de password_reset_form.html para password_reset_form1.html
pronto e direcionei o urls.py para password_reset_form1.html dai ele não pega mais o formulario padrao é isso boa sorte.