[Django] #24941: Add get_exclude() hook to BaseModelAdmin

18 views
Skip to first unread message

Django

unread,
Jun 6, 2015, 2:09:28 AM6/6/15
to django-...@googlegroups.com
#24941: Add get_exclude() hook to BaseModelAdmin
-------------------------------+--------------------
Reporter: peterfarrell | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
TL;DR: Most attributes in the admin have get_XXX() hooks however exclude
is missing this functionality. This ticket is to add get_exclude() hook to
so it matches the same pattern of hooks the rest of the admin has.

I have a patch in the works if accepted.
--

We're building out a custom admin base for CleanerVersion in which we
subclass ModelAdmin. We needed to dynamically get the developer's choices
in exclude and add in our own without overwriting the developer's settings
in their concrete class. Just about all other attributes have their own
hook method in order to get at attribute values, but exclude seems to be
the only one that is doesn't follow this pattern.

It is possible to "mock" this without having to override bunch of other
methods by using a @property descriptor, but this causes the admin checks
to throw an error when performing the check on exclude. This is monkey
patched by subclassing the admin checks class and overriding the check for
exclude. Less than ideal.

Simple solution is add an get_exclude() method to the BaseModelAdmin so it
offers the same hook methods that are available for list_display, fields,
etc.

--
Ticket URL: <https://code.djangoproject.com/ticket/24941>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 6, 2015, 11:27:33 AM6/6/15
to django-...@googlegroups.com
#24941: Add get_exclude() hook to BaseModelAdmin
-------------------------------+--------------------------------------

Reporter: peterfarrell | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by timgraham):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

[https://groups.google.com/d/topic/django-
developers/WrnhmTyLHuY/discussion thread on django-developers].

--
Ticket URL: <https://code.djangoproject.com/ticket/24941#comment:1>

Django

unread,
Jun 13, 2015, 5:57:15 PM6/13/15
to django-...@googlegroups.com
#24941: Add get_exclude() hook to BaseModelAdmin
-------------------------------+------------------------------------

Reporter: peterfarrell | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timgraham):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/24941#comment:2>

Django

unread,
Jun 24, 2015, 3:53:21 AM6/24/15
to django-...@googlegroups.com
#24941: Add get_exclude() hook to BaseModelAdmin
-------------------------------+---------------------------------------
Reporter: peterfarrell | Owner: SujaySKumar
Type: New feature | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+---------------------------------------
Changes (by SujaySKumar):

* owner: nobody => SujaySKumar
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/24941#comment:3>

Django

unread,
Jun 24, 2015, 4:32:53 AM6/24/15
to django-...@googlegroups.com
#24941: Add get_exclude() hook to BaseModelAdmin
-------------------------------+---------------------------------------
Reporter: peterfarrell | Owner: SujaySKumar
Type: New feature | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+---------------------------------------
Changes (by SujaySKumar):

* has_patch: 0 => 1
* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/24941#comment:4>

Django

unread,
Aug 31, 2015, 1:06:00 PM8/31/15
to django-...@googlegroups.com
#24941: Add get_exclude() hook to BaseModelAdmin
-------------------------------+---------------------------------------
Reporter: peterfarrell | Owner: olasitarska

Type: New feature | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+---------------------------------------
Changes (by olasitarska):

* owner: SujaySKumar => olasitarska
* has_patch: 1 => 0
* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/24941#comment:5>

Django

unread,
Aug 31, 2015, 1:09:09 PM8/31/15
to django-...@googlegroups.com
#24941: Add get_exclude() hook to BaseModelAdmin
-------------------------------+---------------------------------------
Reporter: peterfarrell | Owner: olasitarska
Type: New feature | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+---------------------------------------
Changes (by olasitarska):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/5214 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/24941#comment:6>

Django

unread,
Sep 8, 2015, 8:11:21 PM9/8/15
to django-...@googlegroups.com
#24941: Add get_exclude() hook to BaseModelAdmin
-------------------------------+---------------------------------------
Reporter: peterfarrell | Owner: olasitarska
Type: New feature | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------+---------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


Comment:

I left comments for improvement on the pull request.

--
Ticket URL: <https://code.djangoproject.com/ticket/24941#comment:7>

Django

unread,
Sep 13, 2016, 2:52:54 PM9/13/16
to django-...@googlegroups.com
#24941: Add get_exclude() hook to BaseModelAdmin
-------------------------------+---------------------------------------
Reporter: peterfarrell | Owner: olasitarska
Type: New feature | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+---------------------------------------
Changes (by zborboa-g):

* cc: zborboa@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24941#comment:8>

Django

unread,
Sep 21, 2016, 12:09:40 PM9/21/16
to django-...@googlegroups.com
#24941: Add get_exclude() hook to BaseModelAdmin
----------------------------------+---------------------------------------
Reporter: Peter J. Farrell | Owner: Zach Borboa

Type: New feature | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by Zach Borboa):

* owner: Ola Sitarska => Zach Borboa
* needs_better_patch: 1 => 0


Comment:

[https://github.com/django/django/pull/7252 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/24941#comment:9>

Django

unread,
Sep 22, 2016, 4:26:31 PM9/22/16
to django-...@googlegroups.com
#24941: Add get_exclude() hook to BaseModelAdmin
----------------------------------+---------------------------------------
Reporter: Peter J. Farrell | Owner: Zach Borboa
Type: New feature | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/24941#comment:10>

Django

unread,
Sep 29, 2016, 10:30:44 AM9/29/16
to django-...@googlegroups.com
#24941: Add get_exclude() hook to BaseModelAdmin
----------------------------------+---------------------------------------
Reporter: Peter J. Farrell | Owner: Zach Borboa
Type: New feature | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/24941#comment:11>

Django

unread,
Oct 3, 2016, 7:39:31 PM10/3/16
to django-...@googlegroups.com
#24941: Add get_exclude() hook to BaseModelAdmin
----------------------------------+---------------------------------------
Reporter: Peter J. Farrell | Owner: Zach Borboa
Type: New feature | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by Tim Graham):

* needs_tests: 0 => 1


Comment:

As noted on the PR, tests for the `ModelAdmin.get_formsets()` changes are
missing.

--
Ticket URL: <https://code.djangoproject.com/ticket/24941#comment:12>

Django

unread,
Oct 7, 2016, 8:08:32 AM10/7/16
to django-...@googlegroups.com
#24941: Add get_exclude() hook to BaseModelAdmin
----------------------------------+---------------------------------------
Reporter: Peter J. Farrell | Owner: Zach Borboa
Type: New feature | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by Tim Graham):

* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/24941#comment:13>

Django

unread,
Oct 7, 2016, 7:00:22 PM10/7/16
to django-...@googlegroups.com
#24941: Add get_exclude() hook to BaseModelAdmin
----------------------------------+---------------------------------------
Reporter: Peter J. Farrell | Owner: Zach Borboa
Type: New feature | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"bf91be83d56d70181de807a5e8d22679cf63a52f" bf91be83]:
{{{
#!CommitTicketReference repository=""
revision="bf91be83d56d70181de807a5e8d22679cf63a52f"
Fixed #24941 -- Added ModelAdmin.get_exclude().

Thanks Ola Sitarska for the initial patch.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24941#comment:14>

Reply all
Reply to author
Forward
0 new messages