Django templates priority order

  • First, the TEMPLATE_DIRS dir setting in settings.py file of the project enviroment
  • Secondly, templates dir into de apps.
  • The last one is the propertly app which use this template

In addition templates used by admin gui or any other Django core module  can be overwritten in cascade. For example:

  • /usr/share/pyshared/django/contrib/admin/templates/admin/change_list_results.html
  • <app_dir>/templates/admin/change_list_results.html
  • <app_dir>/templates/admin/<lowercase_app_name>/change_list_results.html
  • <app_dir>/templates/admin/<lowercase_app_name>/<lowercase_model_name>/change_list_results.html

these templates are being replaced by the next one in order. That is, you can replace the template for a concrete template for a singular model of a specific application.

Leave a comment

:-)

I’m Pablo Saavedra, a former Unix systems administrator turned embedded software developer, now dedicated to squashing bugs and optimizing performance on embedded devices..

I’m degree  in Computer Science by Universade da Coruña (Spain).

Of course, my hobbies are anything similar to computers, but also boxing, fitness, good beers, … You can follow me on twitter or my linkedin profile,