Opened 11 years ago

Closed 8 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


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 11 years ago.

Download all attachments as: .zip

Change History (13)

Changed 11 years ago by Jerome Leclanche

Attachment: admin-action-input.patch added

comment:1 Changed 11 years ago by Will Hardy

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 Changed 11 years ago by Jerome Leclanche

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 Changed 11 years ago by Alex Gaynor

Triage Stage: UnreviewedDesign decision needed

comment:4 Changed 11 years ago by Mikhail Korobov

Cc: kmike84@… added

comment:5 Changed 11 years ago by Tay Ray Chuan

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 Changed 9 years ago by Chris Beaven

Severity: Normal
Type: New feature

comment:7 Changed 9 years ago by Jannis Leidel

Version: 1.1-beta-1

comment:8 Changed 9 years ago by Julien Phalip

UI/UX: set

comment:9 Changed 9 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:10 Changed 9 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:11 Changed 9 years ago by Aymeric Augustin

UI/UX: set

Revert accidental batch modification.

comment:12 Changed 8 years ago by Aymeric Augustin

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