Django all-auth templates - some questions?

Hello,

I’m working on my first Django project and am currently building out the sign up and user management flows.

I’m currently customizing my django allauth templates and whilst this is working, it’s raised a few questions that i’d be interested to ask people with more experience using the tool than myself.

From the templates documentation:

Therefore it is recommended that you copy all templates over to your own project and adjust them as you see fit.

At the moment i’ve edited the allauth/layouts/base.html file to include my navbar and footer and will continue to style the individual elements too.

The questions I have on this are:

  1. What happens if/when a new version of django all-auth comes out that requires a change to templates? Should I expect to have to copy over the templates again? Does anyone have any experience of how this went in the real world?

  2. I am aware of a django all-auth ui tool around, but my app uses bootstrap css, not tailwind. Anyone know of tools for bootstrap?

  3. What is your overall developer experience like using all-auth? I’m surprised that the recommendation is to copy and paste if i’m honest.

Thanks for your time,
David

I’m not. That’s the “expected” / “typical” way to alter templates supplied by any third-party package. See How to override templates.

Technically, you could build such an overriding template from scratch - there’s no requirement that you start by “copy / paste”. However, for any complex template, it’s probably the easiest way to get started with your modifications.

I would expect it to be extremely rare that a change to all-auth would require a change to the templates. But yes, in that situation, you would want to evaluate those changes relative to the version you are using.

2 Likes

Thanks Ken, I’ve already read some of your previous answers to questions on this board and they’re very useful.

Appreciate the links, it seems more clear now. Good to know that it’s unlikely the templates will change very often.

Have a good easter

For clarity and precision - If the template changes, it will have no effect on you. The original template can be changed frequently and not necessitate any changes to your versions of those templates.

It’s only a change to the view (or form) that could require you to change the template. More specifically, the rendering engine uses the context to provide data to render variables within that template. If the context changes, you may need to change your template to account for that. Or, if the view that a form posts to changes (e.g. changing the name of a field), then your template might need to be adjusted for that.

So what you need to watch out for is that “contract” between the view and the template - Will the template properly render everything that it needs to render in the context? Will the rendered page return all the right data to the view? Those are the issues you need to worry about.

1 Like

That’s awesome, appreciate the help and clarifications