#30311: Can't replace global admin actions with specialized ones per-admin
-------------------------------+--------------------------------------
Reporter: Aarni Koskela | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 2.2
Severity: Normal | Resolution: invalid
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 Carlton Gibson):
* status: new => closed
* resolution: => invalid
Comment:
Right, OK, gotcha.
Multiple defined actions with the same name are not supported. The system
check added in #29711 led directly to uncovering #29917, which had been
latent for many years.
As per the discussion on #29917, and the mailing list thread (that I
linked above), the decision was taken to adjust this behaviour.
You need to adjust your code to use site wide actions, or as an
alternative you can use subclassing, but now according to Python's normal
inheritance rules.
This was an example from the discussion:
{{{
class WithCustom(AdminBase):
actions = AdminBase.actions + ['custom_action']
}}}
You're free to adjust `actions` any way you need (at class, definition, in
`__init__()`, in `_get_base_actions()`, in `get_actions()`...) See the
[https://docs.djangoproject.com/en/2.2/ref/contrib/admin/actions
#disabling-admin-actions Disabling actions] section of the docs. There are
plenty of strategies there.
--
Ticket URL: <https://code.djangoproject.com/ticket/30311#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/061.ffecdafbae36142f1120e3f4cba219c3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.