0👍
I ended up extending my main template from the admin ‘base.html’ template and going from there. A little messy but it works
0👍
All templates that extend from 'base.html'
would contain the content inside {% block header %}
and {% endblock %}
, as long as they do not override the block or its ancestors(by removing the {% block header %}...{% endblock %}
part).
If there are templates that do not extend from base.html
, you could put the code into their common base, or use something like inline tag or inclusion tags
Also, for the code to work properly for authenticated users, you need to ensure there is user
variable in context: normally it’s already there, or you need to re-enable "django.contrib.auth.context_processors.auth"
if you’ve removed it before, check the doc