#10768: Allow for Admin Actions to be applied to an empty QuerySet -------------------------------------+------------------------------------- Reporter: andrepleblanc@… | Owner: nobody Type: Uncategorized | Status: closed Component: contrib.admin | Version: master Severity: Normal | Resolution: wontfix Keywords: actions | Triage Stage: Design | decision needed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Humberto Yances): Replying to [comment:6 Karen Tracey]: > Performing an action on an empty query set should do nothing. Therefore there is no point in calling the action with an empty query set. (If the action did something other than nothing, that would be surprising; enabling such surprises in the admin UI seems like a Bad Idea.) #12281 covers the case of issuing a message that something needs to be selecting before you can successfully perform an action. We should fix #12281 and reject this one. == Actions that don't act on specific items are a fundamentally different I would not state this in such an absolute way, and preclude users the option to make their own wrong choices… Limited to django, I'm not particularly experienced, I seldom contribute to django programs. Now in the current assignment we need to import data from external sources (openstreetmap, wubook), and we either need to refresh a subset of our already existing items, or we want to import things from scratch. The code in the two cases is obviously the same. The "import from scratch" we run on an empty selection, and our initial workaround was really terrible, that is remove everything, add a fake new object, select it, then run the action. I'm looking into the object-tools, and I have several perplexities: one is that it looks quite a bit more work to add them; two is that I need to program my actions elsewhere, while they do fundamentally the same thing; three is that the action I need depends on the table I'm in, it's definitely not a generic tool. so while we can't activate the action on an empty selection, I'm afraid I'm going to register the same action twice, where one will just invoke the other with an empty selection, simply by-passing this django check -- Ticket URL: <https://code.djangoproject.com/ticket/10768#comment:8> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/081.ef14a8fdca43e0642462da26bf08ca64%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.