diff options
| author | Thomas Tanner <tanner@gmx.net> | 2014-12-31 22:25:00 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-12-31 16:31:59 -0500 |
| commit | 46068d850d8debd3611ed6499d48b9907bf07ef6 (patch) | |
| tree | c82c79ff71e611e31dab2bbe1d1e1b9348e5d14e /docs | |
| parent | 7a878ca5cb50ad65fc465cb263a44cc93629f75c (diff) | |
Fixed #22295 -- Replaced permission check for displaying admin user-tools
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 18 | ||||
| -rw-r--r-- | docs/releases/1.8.txt | 17 |
2 files changed, 35 insertions, 0 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 12a2c0cc28..70348e5d47 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -2520,6 +2520,24 @@ Templates can override or extend base admin templates as described in ``AdminSite`` methods --------------------- +.. method:: AdminSite.each_context(request): + + .. versionadded:: 1.7 + + Returns a dictionary of variables to put in the template context for + every page in the admin site. + + Includes the following variables and values by default: + + * ``site_header``: :attr:`AdminSite.site_header` + * ``site_title``: :attr:`AdminSite.site_title` + * ``site_url``: :attr:`AdminSite.site_url` + * ``has_permission``: :meth:`AdminSite.has_permission` + + .. versionchanged:: 1.8 + + The ``request`` argument and the ``has_permission`` variable were added. + .. method:: AdminSite.has_permission(request) Returns ``True`` if the user for the given ``HttpRequest`` has permission diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt index c869cbc5b7..02fae70c82 100644 --- a/docs/releases/1.8.txt +++ b/docs/releases/1.8.txt @@ -136,6 +136,15 @@ Minor features * The ``AdminSite.password_change()`` method now has an ``extra_context`` parameter. +* You can now control who may login to the admin site by overriding only + :meth:`AdminSite.has_permission() + <django.contrib.admin.AdminSite.has_permission>` and + :attr:`AdminSite.login_form <django.contrib.admin.AdminSite.login_form>`. + The ``base.html`` template has a new block ``usertools`` which contains the + user-specific header. A new context variable ``has_permission``, which gets + its value from :meth:`~django.contrib.admin.AdminSite.has_permission`, + indicates whether the user may access the site. + :mod:`django.contrib.admindocs` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -899,6 +908,14 @@ Miscellaneous opposed to the instance name which you can still customize using ``AdminSite(name="...")``. +* The block ``usertools`` in the ``base.html`` template of + :mod:`django.contrib.admin` now requires the ``has_permission`` context + variable to be set. If you have any custom admin views that use this + template, update them to pass :meth:`AdminSite.has_permission() + <django.contrib.admin.AdminSite.has_permission>` as this new variable's + value or simply include :meth:`AdminSite.each_context(request) + <django.contrib.admin.AdminSite.each_context>` in the context. + * Internal changes were made to the :class:`~django.forms.ClearableFileInput` widget to allow more customization. The undocumented ``url_markup_template`` attribute was removed in favor of ``template_with_initial``. |
