Re: [Django] #10768: Allow for Admin Actions to be applied to an empty QuerySet

15 views
Skip to first unread message

Django

unread,
Jul 15, 2015, 4:59:39 AM7/15/15
to django-...@googlegroups.com
#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
-------------------------------------+-------------------------------------
Changes (by xtrinch):

* ui_ux: => 0
* type: => Uncategorized
* severity: => Normal
* easy: => 0


Comment:

I've got promo codes in my admin panel, and it would be really nice if I
could allow users to generate them with a script when they run out of
them...

--
Ticket URL: <https://code.djangoproject.com/ticket/10768#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 8, 2018, 2:11:44 PM8/8/18
to django-...@googlegroups.com
#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

unread,
Aug 30, 2022, 6:03:00 AM8/30/22
to django-...@googlegroups.com
#10768: Allow for Admin Actions to be applied to an empty QuerySet
-------------------------------------+-------------------------------------
Reporter: andrepleblanc@… | Owner: nobody
Type: Uncategorized | Status: closed
Component: contrib.admin | Version: dev

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 hcharp):

Replying to [comment:8 Humberto Yances]:


I have the EXACT same issue ; it can seem to be a bad UI practice, but we
can have needs that you have not thought about yet. And I agree with the
freedom of customization.
Plus, both the doc and community about how to add a button that would do
that are not as clear as the doc for Custom Actions.

For beginners, it could allow to get a MVP, something that could be a bad
UI practice for you, but at least, something that works.

--
Ticket URL: <https://code.djangoproject.com/ticket/10768#comment:9>

Reply all
Reply to author
Forward
0 new messages