diff options
| author | adontz <adontz@gmail.com> | 2022-03-05 20:09:42 +0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-03-25 10:33:44 +0100 |
| commit | 2bee0b4328319eaf6a0d1686677d629f2ecf6dec (patch) | |
| tree | 116b7dea4223da88dc24b422a08bb9bad8d7d05f /docs | |
| parent | d44951b36ef2e698f32a8e1352671689e44c4d62 (diff) | |
Fixed #7497 -- Allowed overriding the order of apps and models in admin.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 33 | ||||
| -rw-r--r-- | docs/releases/4.1.txt | 3 |
2 files changed, 36 insertions, 0 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index ab8da5a729..199a864566 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -2896,6 +2896,39 @@ Templates can override or extend base admin templates as described in The ``model`` variable for each model was added. +.. method:: AdminSite.get_app_list(request, app_label=None) + + Returns a list of applications from the :doc:`application registry + </ref/applications/>` available for the current user. You can optionally + pass an ``app_label`` argument to get details for a single app. Each entry + in the list is a dictionary representing an application with the following + keys: + + * ``app_label``: the application label + * ``app_url``: the URL of the application index in the admin + * ``has_module_perms``: a boolean indicating if displaying and accessing of + the module's index page is permitted for the current user + * ``models``: a list of the models available in the application + * ``name``: name of the application + + Each model is a dictionary with the following keys: + + * ``model``: the model class + * ``object_name``: class name of the model + * ``name``: plural name of the model + * ``perms``: a ``dict`` tracking ``add``, ``change``, ``delete``, and + ``view`` permissions + * ``admin_url``: admin changelist URL for the model + * ``add_url``: admin URL to add a new model instance + + Lists of applications and models are sorted alphabetically by their names. + You can override this method to change the default order on the admin index + page. + + .. versionchanged:: 4.1 + + The ``app_label`` argument was added. + .. method:: AdminSite.has_permission(request) Returns ``True`` if the user for the given ``HttpRequest`` has permission diff --git a/docs/releases/4.1.txt b/docs/releases/4.1.txt index 885c9329c5..39dd2faba9 100644 --- a/docs/releases/4.1.txt +++ b/docs/releases/4.1.txt @@ -63,6 +63,9 @@ Minor features * Related widget wrappers now have a link to object's change form. +* The :meth:`.AdminSite.get_app_list` method now allows changing the order of + apps and models on the admin index page. + :mod:`django.contrib.admindocs` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
