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

Customizing the admin header


To make our admin site feel less generic, we'll replace the default title and header at the top of the pages.

Create a new directory called admin under the directory mycompany/templates. Copy the django/contrib/admin/templates/base_site.html file to your templates/admin directory. This is the first file we'll be overriding.

Replacing the page title

In our admin pages, the page title is presented in this format:

<title>Site administration | Django site admin</title>

This can be changed by editing the title block in base_site.html. Open the mycompany/templates/admin/site_base.html file and edit the block that looks like this:

{% block title %}{{ title }} | {% trans 'Django site admin' %}{% endblock %}

Replace the text in quotes after the pipe symbol with our site's title:

{% block title %}{{ title }} | {% trans 'MyCompany Administration' %}{% endblock %}

Note

The trans tag is used by Django's internationalization (i18n) libraries to translate text into other...