From bf91be83d56d70181de807a5e8d22679cf63a52f Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Thu, 29 Sep 2016 02:55:10 -0700 Subject: Fixed #24941 -- Added ModelAdmin.get_exclude(). Thanks Ola Sitarska for the initial patch. --- docs/ref/contrib/admin/index.txt | 8 ++++++++ docs/releases/1.11.txt | 4 ++++ 2 files changed, 12 insertions(+) (limited to 'docs') diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 845f467b77..4d3ab6dc1f 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -1459,6 +1459,14 @@ templates used by the :class:`ModelAdmin` views: names on the changelist that will be linked to the change view, as described in the :attr:`ModelAdmin.list_display_links` section. +.. method:: ModelAdmin.get_exclude(request, obj=None) + + .. versionadded:: 1.11 + + The ``get_exclude`` method is given the ``HttpRequest`` and the ``obj`` + being edited (or ``None`` on an add form) and is expected to return a list + of fields, as described in :attr:`ModelAdmin.exclude`. + .. method:: ModelAdmin.get_fields(request, obj=None) The ``get_fields`` method is given the ``HttpRequest`` and the ``obj`` diff --git a/docs/releases/1.11.txt b/docs/releases/1.11.txt index f5faedd0a9..ff77ebeabb 100644 --- a/docs/releases/1.11.txt +++ b/docs/releases/1.11.txt @@ -68,6 +68,10 @@ Minor features * :attr:`.ModelAdmin.date_hierarchy` can now reference fields across relations. +* The new :meth:`ModelAdmin.get_exclude() + ` hook allows specifying the + exclude fields based on the request or model instance. + :mod:`django.contrib.admindocs` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.3