Add get_exclude() hook to BaseModelAdmin
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.
Change History
(14)
Triage Stage: |
Unreviewed → Accepted
|
Owner: |
changed from nobody to Sujay S Kumar
|
Status: |
new → assigned
|
Has patch: |
set
|
Needs tests: |
set
|
Has patch: |
unset
|
Needs tests: |
unset
|
Owner: |
changed from Sujay S Kumar to Ola Sitarska
|
Patch needs improvement: |
set
|
Owner: |
changed from Ola Sitarska to Zach Borboa
|
Patch needs improvement: |
unset
|
Patch needs improvement: |
set
|
Patch needs improvement: |
unset
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
thread on django-developers.