Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango: Can't override admin templates when they are already overridden?
    primarykey
    data
    text
    <p>To add some content to a Django admin view of a model, I want to override the <code>change_form.html</code> template. According to the <a href="https://docs.djangoproject.com/en/1.4/ref/contrib/admin/#overriding-admin-templates" rel="nofollow">documentation</a> I would need to create a file <code>change_form.html</code> in a the folder <code>/project-path/templates/admin/appname/modelname/</code>. Of course I need to make sure, that this path is also available in <code>TEMPLATE_DIRS</code>. Such a file could look like this:</p> <pre><code>{% extends "admin/change_form.html" %} {% load i18n %} {% block after_field_sets %} SOME CONTENT {% endblock %} </code></pre> <p>However, I make use of <a href="https://github.com/lukaszb/django-guardian" rel="nofollow">django-guardian</a> to have object permissions. This Django app overrides <code>change_form.html</code> as well (which works fine -- relevant source seems to be <a href="https://github.com/lukaszb/django-guardian/blob/master/guardian/admin.py" rel="nofollow">here</a>), but Django doesn't pick up my template extension file (i.e. "SOME CONTENT" from the sample above isn't displayed). The blocks/parts I want to override are <em>not</em> the same ones that django-guardian overrides and eventually I want to have the additions to <code>change_form.html</code> of django-guardion <em>and</em> of my template.</p> <p>What am I doing wrong here? And is possible at all to have multiple applications overriding an admin template?</p> <p>If it is of interest, this is my <code>TEMPLATE_LOADERS</code> setting:</p> <pre><code>TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader' ) </code></pre> <p>Also, django-guardian is the last app in the <code>INSTALLED_APPS</code> array.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload