#35611 closed New feature (wontfix)
Admin action without the need to select objects
Reported by: | Patrick Hintermayer | Owned by: | |
---|---|---|---|
Component: | contrib.admin | Version: | 5.0 |
Severity: | Normal | Keywords: | actions |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I suggest adding a new option to write actions which does not need objects to be selected. For example we want to add an action to reset a reminder flag for all existing objects. But if you haven't selected any objects, it does not work and shows you the message, that no objects were selected.
A possible non-breaking option could be to add a new optional parameter to the @admin.action() decorator to deactivate the previously mentioned behavior.
Alternative with a new field, e. g. "extended_actions":
https://gist.github.com/rafen/eff7adae38903eee76600cff40b8b659
Attachments (1)
Change History (4)
comment:1 by , 5 months ago
Description: | modified (diff) |
---|
by , 5 months ago
Attachment: | image-20240718-090920.png added |
---|
comment:2 by , 5 months ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:3 by , 5 months ago
Hi Sarah,
thank you for your message. I created a thread on the forum.
Regarding the "Select all":
we use a custom admin theme where we don't have this option. But if it's actually rendering all objects (in our first case more than 7k objects), I would assume that it will hit some bottleneck
Hi Patrick, thank you for the ticket
When requesting a new feature to Django, we first want to see the feature proposed and discussed with the community and gain consensus. To do that, please consider starting a new conversation on the Django Forum, where you'll reach a wider audience and likely get extra feedback.
I'll close the ticket for now, but if there is a community agreement for the feature request, you are welcome to come back to the ticket and point to the forum topic, so we can then re-open it. For more details, please see the documented guidelines for requesting features.
To give some initial feedback, it's worth noting that we do have functionality to "select all" objects but perhaps there is a reason this is unsuitable for your example?
If you want an easy way to "select all" and this doesn't work (maybe too many objects to render) that might be a bug we can look into.
It's also worth highlighting the likely addition of #12090 which would allow the actions to be triggered on the edit page for that specific object. If actions are independent of objects, this would need to be considered.