1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #34303 –- Allowed customizing admin site log entry list.

Added AdminSite.get_log_entries() as an override point and made this
available to the template via each_context().
This commit is contained in:
Jacob Rief
2023-02-08 18:37:32 +01:00
committed by GitHub
parent 1964e4367f
commit 473283d241
8 changed files with 76 additions and 13 deletions

View File

@@ -2832,6 +2832,7 @@ Templates can override or extend base admin templates as described in
* ``is_popup``: whether the current page is displayed in a popup window
* ``is_nav_sidebar_enabled``: :attr:`AdminSite.enable_nav_sidebar`
* ``log_entries``: :meth:`.AdminSite.get_log_entries`
.. method:: AdminSite.get_app_list(request, app_label=None)
@@ -2889,6 +2890,15 @@ Templates can override or extend base admin templates as described in
Raises ``django.contrib.admin.sites.NotRegistered`` if a model isn't
already registered.
.. method:: AdminSite.get_log_entries(request)
.. versionadded:: 5.0
Returns a queryset for the related
:class:`~django.contrib.admin.models.LogEntry` instances, shown on the site
index page. This method can be overridden to filter the log entries by
other criteria.
.. _hooking-adminsite-to-urlconf:
Hooking ``AdminSite`` instances into your URLconf

View File

@@ -43,7 +43,8 @@ Minor features
:mod:`django.contrib.admin`
~~~~~~~~~~~~~~~~~~~~~~~~~~~
* ...
* The new :meth:`.AdminSite.get_log_entries` method allows customizing the
queryset for the site's listed log entries.
:mod:`django.contrib.admindocs`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~