Opened 7 years ago

Closed 3 years ago

#11732 closed New feature (wontfix)

ModelAdmin.get_changelist_form should use ModelAdmin.form

Reported by: edcrypt 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 7 years ago by edcrypt

  • milestone set to 1.2
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 7 years ago by lukeplant

  • Triage Stage changed from Unreviewed to Design 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 6 years ago by ubernostrum

  • milestone 1.2 deleted

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

comment:4 Changed 6 years ago by andybak

  • Cc andy@… added

comment:5 Changed 6 years ago by subsume

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

comment:6 Changed 5 years ago by julien

  • Severity set to Normal
  • Type set to New feature

comment:7 Changed 5 years ago by julien

  • Easy pickings unset
  • UI/UX unset

See related issue in #11651.

comment:8 Changed 4 years ago by anonymous

Any updates on this ?

comment:9 Changed 4 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 3 years ago by jacob

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

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