pythondjangodjango-templatesdjango-allauth

How to override All Auth built-in templates Django


I am using Django all auth to implement password reset functionality but I want to customize the template of password reset,here's below my urls:

urls.py

from django.conf.urls import url,include
from django.urls import path
from rest_framework_jwt.views import obtain_jwt_token,refresh_jwt_token
from . import views


# Registration,Login,Forgot,Profile change

urlpatterns=[

    url(r'^accounts/', include('allauth.urls')),

]

and when I hit this url->http://127.0.0.1:8000/ThiefApp/accounts/password/reset/

I got below template

enter image description here

How can I customize the above template or how can I use different template.Any suggestions?


Solution

  • allauth contains many templates in allauth/templates directory. If you want to override any template then you need to add the template with the same name in your project that allauth template directory contains.(Ref : https://django-allauth.readthedocs.io/en/latest/templates.html#overridable-templates).

    Here you want to override password reset page then create a template of "password_reset.html" in your project. Your template directory structure must be like yourproject/templates/allauth/account/. I hope this will help you:)