Book Image

Django 1.0 Template Development

Book Image

Django 1.0 Template Development

Overview of this book

Table of Contents (17 chapters)
Django 1.0 Template Development
Credits
About the Author
About the Reviewers
Preface
Index

Overriding the admin templates


Before we can start modifying the admin templates, we need to explore their structure. The templates used for the admin are no different than other Django templates, and you already know everything needed to work with them. We don't want to edit the existing admin templates as they are part of the Django source code. If we edit them, we might lose our changes when updating Django as they could get overridden with the new files. Instead, we will override the files and leave the originals untouched.

Leveraging the template loader

In an earlier chapter, we talked about the app_directories template loader that looks for a directory called templates underneath your individual applications. This is how the admin templates "automatically" appear. They are found in a directory in the Django admin source code. (We'll look at them shortly.)

In our mycompany/settings.py file, we use both the filesystem and app_directories loaders:

TEMPLATE_LOADERS = (
    'django.template...