#10596 closed (fixed)
There should be a better way to remove the actions provided by parent classes
Reported by: | ElliottM | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | admin bulk default | |
Cc: | kmike84@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The people who use my admin site have very clear instructions to set "is_active" to false rather than deleting users. I obviously trust them if I'm giving them superuser access, but at the same time I don't think it's a good idea to put in even larger shiny red button and keep telling them not to press it; the current delete button is red and shiny enough as it is.
In fact, only one of the several models that are managed via my admin site are ever deleted via the admin, and there are so few of those models at a time that bulk deletion isn't necessary.
I therefore want the "delete selected items" to not be enabled by default, or I want an option in the modeladmin to disable a given global action for this model, or preferably both.
Change History (7)
comment:1 by , 16 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
comment:2 by , 16 years ago
That's not documented though. Get_actions isn't mentioned once in the admin actions documentation page.
comment:3 by , 16 years ago
milestone: | → 1.1 |
---|---|
Resolution: | duplicate |
Status: | closed → reopened |
Summary: | There should be a way to remove the "Delete selected items" bulk admin action. → There should be a better way to remove the actions provided by parent classes |
Triage Stage: | Unreviewed → Accepted |
Version: | 1.0-beta-1 → SVN |
Reopened with a better, more general title; I agree this needs to be fixed for the feature to be generally usable.
comment:5 by , 16 years ago
Cc: | added |
---|
comment:6 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
(In [10408]) Made a bunch of improvements to admin actions. Be warned: this includes one minor but BACKWARDS-INCOMPATIBLE change.
These changes are:
- BACKWARDS-INCOMPATIBLE CHANGE: action functions and action methods now share the same signature:
(modeladmin, request, queryset)
. Actions defined as methods stay the same, but if you've defined an action as a standalone function you'll now need to add that firstmodeladmin
argument. - The delete selected action is now a standalone function registered site-wide; this makes disabling it easy.
- Fixed #10596: there are now official, documented
AdminSite
APIs for dealing with actions, including a method to disable global actions. You can still re-enable globally-disabled actions on a case-by-case basis. - Fixed #10595: you can now disable actions for a particular
ModelAdmin
by settingactions
toNone
. - Fixed #10734: actions are now sorted (by name).
- Fixed #10618: the action is now taken from the form whose "submit" button you clicked, not arbitrarily the last form on the page.
- All of the above is documented and tested.
This can currently be done by overiding get_actions() to remove the 'delete_selected' option(or whatever ones you want to remove. There's also #10595