1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #9602 -- Added AdminSite.get_model_admin().

This allows retrieving an admin class for the given model class without
using internal attributes.
This commit is contained in:
Mariusz Felisiak
2023-07-07 08:06:01 +02:00
committed by GitHub
parent d569c1dcfe
commit f64fd47a76
15 changed files with 127 additions and 69 deletions

View File

@@ -3024,6 +3024,13 @@ 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_model_admin(model)
.. versionadded:: 5.0
Returns an admin class for the given model class. Raises
``django.contrib.admin.sites.NotRegistered`` if a model isn't registered.
.. method:: AdminSite.get_log_entries(request)
.. versionadded:: 5.0

View File

@@ -145,6 +145,9 @@ Minor features
* ``XRegExp`` is upgraded from version 3.2.0 to 5.1.1.
* The new :meth:`.AdminSite.get_model_admin` method returns an admin class for
the given model class.
:mod:`django.contrib.admindocs`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~