Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

overriding default templates of django-allauth

I used this social registration/signup library django allauth for a project of mine. How do i customize the default templates and forms to give a better look and feel?

like image 278
user993563 Avatar asked Feb 24 '12 20:02

user993563


People also ask

How do I override Django Allauth?

Override Django-AllAuth Template Forms (Login/Signup) Instead of writing your own templates, just copy-paste the allauth templates in your project directory templates and edit them as you want. Copy all the files/directories from allauth templates.

What is Allauth in Django?

Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (social) account authentication.

Where can I find templates in Django?

To configure the Django template system, go to the settings.py file and update the DIRS to the path of the templates folder. Generally, the templates folder is created and kept in the sample directory where manage.py lives. This templates folder contains all the templates you will create in different Django Apps.


2 Answers

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.

like image 121
Chris Lawlor Avatar answered Nov 03 '22 02:11

Chris Lawlor


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.

like image 35
whatf Avatar answered Nov 03 '22 03:11

whatf