-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
273a1e6
commit a962286
Showing
4 changed files
with
115 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
{% extends "admin/base.html" %} | ||
{% load i18n %} | ||
|
||
{% block title %}{{ title }} | {% trans 'Django site admin' %}{% endblock %} | ||
{% block title %}{{ title }} | {{ site_title }}{% endblock %} | ||
|
||
{% block branding %} | ||
<h1 id="site-name">{% trans 'Django administration' %}</h1> | ||
<h1 id="site-name">{{ site_header }}</h1> | ||
{% endblock %} | ||
|
||
{% block nav-global %}{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
adrianholovaty
Author
Member
|
||
.. 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 | ||
|
2 comments
on commit a962286
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This introduces a problem with some auth templates - https://code.djangoproject.com/ticket/21293.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This problem is blocking the 1.7 release.
@adrianholovaty Would you have a few minutes to take a look at the ticket?
Couple of issues here:
I can fix all this if you want.
p.s. After doing things "the hard way" in the tutorial, we could point out this feature there as well.