Added AdminSite attributes for easily changing admin title.

AdminSite now has overridable site_header, site_title and index_title attributes. Changed
each admin view to pass these to the context (in a new AdminSite.each_context() method).
The intent here is to make it easier to override these things in the common case, instead of
having to override a template, which is a bigger burden.
This commit is contained in:
Adrian Holovaty 2013-09-06 12:31:44 -05:00
parent 273a1e6b8d
commit a962286b74
4 changed files with 115 additions and 80 deletions

View file

@ -2162,7 +2162,7 @@ creating your own ``AdminSite`` instance (see below), and changing the
Python class), and register your models and ``ModelAdmin`` subclasses
with it instead of using the default.
When constructing an instance of an ``AdminSite``, you are able to provide
When constructing an instance of an ``AdminSite``, you can provide
a unique instance name using the ``name`` argument to the constructor. This
instance name is used to identify the instance, especially when
:ref:`reversing admin URLs <admin-reverse-urls>`. If no instance name is
@ -2174,6 +2174,21 @@ creating your own ``AdminSite`` instance (see below), and changing the
Templates can override or extend base admin templates as described in
`Overriding Admin Templates`_.
.. versionadded:: 1.6
.. attribute:: AdminSite.site_header
The text to put at the top of each admin page, as an ``<h1>`` (a string).
By default, this is "Django administration".
.. versionadded:: 1.6
.. attribute:: AdminSite.site_title
The text to put at the end of each admin page's ``<title>`` (a string). By
default, this is "Django site admin".
.. versionadded:: 1.6
.. attribute:: AdminSite.index_title
The text to put at the top of the admin index page (a string). By default,
this is "Site administration".
.. attribute:: AdminSite.index_template
Path to a custom template that will be used by the admin site main index