﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25387	ModelAdmin actions don't get access to the ActionForm	Malcolm Box	nobody	"Setting an alternative ModelAdmin.action_form is supported, but ModelAdmin.actions don't get access to the form.

The naive approach is to rebind the form in the action:

{{{
class ExampleAdmin(admin.ModelAdmin):
     action_form = ExampleForm
     actions = ['example_action']
 
     def example_action(self, request, queryset):
         form = ExampleForm(request.POST)
         if form.is_valid():
             # Process...
}}}

However, this doesn't work (`form.is_valid()` returns False) because there's special processing done on the `request.DATA` before the form is bound - see https://github.com/django/django/blob/master/django/contrib/admin/options.py#L1205-L1220

So either this code has to be duplicated in the action, or the `request.POST` data processed manually. Neither seem ideal.

A proposed fix would be to make the action_form that's bound in options.py be available as `self.bound_action_form` so that actions could access it. This would be entirely backwards-compatible.
         "	New feature	new	contrib.admin	dev	Normal				Accepted	0	0	0	0	0	0
