User login

Overriding Django's admin template from a custom app

If you have tried to override an administrative template in Django using the app directories template loader functionality, you may have found yourself growing frustrated— I mean, you may have found yourself going insane.

The problem was acknowledged but

The order of INSTALLED_APPS is significant! Translations and Templates in Django can be overridden; the first app found will have priority.

See https://docs.djangoproject.com/en/1.7/ref/templates/api/#django.template.loaders.app_directories.Loader

Improve documentation: order in INSTALLED_APPS matters for translations and templates
https://code.djangoproject.com/ticket/20914

Furthermore...

If you are only trying to customize the title and header, there's no need to override the template nor to do the complicated customization described in the docs (which requires registering the ModelAdmin yourself)— you can place the following lines in your urls.py to override the title (in the browser bar/tab), the header, and the text for the index title, like this:

admin.site.site_header = 'Custom administration'

Searched words: 
django.template.loaders.app_directories.Loader order matters template_loaders not working django django admin template override base_site.html not working django force reload template cache

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.