Opened 16 years ago

Closed 12 years ago

#10871 closed New feature (wontfix)

Add input support to admin actions (with patch)

Reported by: Jerome Leclanche Owned by: Jerome Leclanche
Component: contrib.admin Version:
Severity: Normal Keywords:
Cc: kmike84@… Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description

I wanted to be able to set tags to a lot of objects at once in the admin site.
The attached patch adds a takes_input attribute to an admin action (default False). If set to True, a 4th "input" argument will be passed, which you can use as such:

def add_tag(modeladmin, request, queryset, input):
	for obj in queryset:
		Tag.objects.add_tag(obj, input)
add_tag.takes_input = True

I'd love some comments on it. Some TODO would be:

  • Hiding the input if no give action takes an input
  • js-disabling it if the current selected action doesn't take an input.. not too sure about that.

Attachments (1)

admin-action-input.patch (4.0 KB ) - added by Jerome Leclanche 16 years ago.

Download all attachments as: .zip

Change History (13)

by Jerome Leclanche, 16 years ago

Attachment: admin-action-input.patch added

comment:1 by Will Hardy, 16 years ago

Would I be right in saying that this can already be done using an action with an intermediate page?

A change like this appears to complicate things, and doesn't cover the field (it only works where the required input is a single line of text).

comment:2 by Jerome Leclanche, 16 years ago

It's personally one of the things I'd expect to be able to do without an intermediate page. Per the docs, and intermediate page would be for more complex actions. Adding an input field on-demand, to me, sounds reasonable.

comment:3 by Alex Gaynor, 15 years ago

Triage Stage: UnreviewedDesign decision needed

comment:4 by Mikhail Korobov, 15 years ago

Cc: kmike84@… added

comment:5 by Tay Ray Chuan, 15 years ago

I quote Version1.2Features:

Admin-03 (Support for input arguments on admin actions.) - this would overly complicate the admin UI and dilute the purpose of the admin actions.

Thought this would be relevant to this discussion.

comment:6 by Chris Beaven, 14 years ago

Severity: Normal
Type: New feature

comment:7 by Jannis Leidel, 14 years ago

Version: 1.1-beta-1

comment:8 by Julien Phalip, 14 years ago

UI/UX: set

comment:9 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:10 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:11 by Aymeric Augustin, 13 years ago

UI/UX: set

Revert accidental batch modification.

comment:12 by Aymeric Augustin, 12 years ago

Resolution: wontfix
Status: newclosed

Comment 5 points out this was rejected in the past. To reverse that decision, please make your case on django-developers.

Note: See TracTickets for help on using tickets.
Back to Top