Opened 11 years ago

Closed 7 years ago

#11732 closed New feature (wontfix)

ModelAdmin.get_changelist_form should use ModelAdmin.form

Reported by: Eduardo de Oliveira Padoan Owned by: nobody
Component: contrib.admin Version: 1.1
Severity: Normal Keywords:
Cc: andy@… Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When you create a ModelForm to associate with a ModelAdmin, using the 'form' option, this form will not be used on the list_editable form. When I define a .clean() method, I'd like the validation to work both on the changeform and on the changelist.

A quick fix:

     def get_changelist_form(self, request, **kwargs):
         defaults = {
+            "form": self.form,
            "formfield_callback": curry(self.formfield_for_dbfield,
         return modelform_factory(self.model, **defaults)

Change History (10)

comment:1 Changed 11 years ago by Eduardo de Oliveira Padoan

milestone: 1.2

comment:2 Changed 10 years ago by Luke Plant

Triage Stage: UnreviewedDesign decision needed

That's a really bad idea, and would cause lots of breakages, because many people will be assuming that the Form they have created will be used only for the change form, and not the change list. We need a new attribute like 'changelist_form', if anything.

comment:3 Changed 10 years ago by James Bennett

milestone: 1.2

1.2 is feature-frozen, moving this feature request off the milestone.

comment:4 Changed 10 years ago by Andy Baker

Cc: andy@… added

comment:5 Changed 9 years ago by Yeago

I agree with lukeplant and yet with raw_id_fields, here we are creating an admin option which affects both.

comment:6 Changed 9 years ago by Julien Phalip

Severity: Normal
Type: New feature

comment:7 Changed 9 years ago by Julien Phalip

Easy pickings: unset
UI/UX: unset

See related issue in #11651.

comment:8 Changed 7 years ago by anonymous

Any updates on this ?

comment:9 Changed 7 years ago by pwbdecker@…

Presently to add validation to the change list form I have to override get_changelist_form to return my custom form. I would also like to see the option to be able to use the admin options form.

comment:10 Changed 7 years ago by Jacob

Resolution: wontfix
Status: newclosed

I'm with Luke: this isn't something we should change; the downsides outweigh the upsides.

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