Opened 7 years ago

Closed 3 years ago

#10871 closed New feature (wontfix)

Add input support to admin actions (with patch)

Reported by: Adys Owned by: Adys
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 Adys 7 years ago.

Download all attachments as: .zip

Change History (13)

Changed 7 years ago by Adys

comment:1 Changed 7 years ago by Will Hardy

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 7 years ago by Adys

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

  • Triage Stage changed from Unreviewed to Design decision needed

comment:4 Changed 7 years ago by kmike

  • Cc kmike84@… added

comment:5 Changed 6 years ago by rctay

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 5 years ago by SmileyChris

  • Severity set to Normal
  • Type set to New feature

comment:7 Changed 5 years ago by jezdez

  • Version 1.1-beta-1 deleted

comment:8 Changed 5 years ago by julien

  • UI/UX set

comment:9 Changed 5 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:10 Changed 5 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:11 Changed 5 years ago by aaugustin

  • UI/UX set

Revert accidental batch modification.

comment:12 Changed 3 years ago by aaugustin

  • Resolution set to wontfix
  • Status changed from new to closed

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