overriding default templates of django-allauth overriding default templates of django-allauth django django

overriding default templates of django-allauth


Assuming you have set a project level templates directory using the TEMPLATE_DIRS setting like:

TEMPLATE_DIRS = [    os.path.join(PROJECT_DIR, 'templates'),]

You should be able to copy all of the folders shown here into that directory and edit them as you need. Most of the templates seem to be filling a {% block content %} block, so it's probably easiest if your site_base.html template defines that block somewhere.

If you haven't set TEMPLATE_DIRS, you can do the same thing, but copy the template folders into the templates directory of one of your apps. I prefer to set TEMPLATE_DIRS and keep the main site templates like base.html there, since they don't really belong to a particular app, but that's really just a preference; the template loader should find them either way.


the latest version of all-auth on github has its templates outside, however the one on Pypi is not, all you need to do is clone the repo in your project directory and override the templates. As simple as that.


In your views:

from allauth.account.views import SignupView, LoginViewclass MySignupView(SignupView):    template_name = 'my_signup.html'class MyLoginView(LoginView):    template_name = 'my_login.html'

Do pay attention to the examples and docs for structuring your own templates.

Watch this piece in the example templates though:

<form id="signup_form" method="post" action="{% url 'account_signup' %}">

I had to remove the URL link to make it work properly in my own template:

<form id="signup_form" method="post" action="">'