Opened 15 years ago
Closed 12 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 |
Description
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, request=request), } defaults.update(kwargs) return modelform_factory(self.model, **defaults)
Change History (10)
comment:1 by , 15 years ago
milestone: | → 1.2 |
---|
comment:2 by , 15 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:3 by , 15 years ago
milestone: | 1.2 |
---|
1.2 is feature-frozen, moving this feature request off the milestone.
comment:4 by , 15 years ago
Cc: | added |
---|
comment:5 by , 14 years ago
I agree with lukeplant and yet with raw_id_fields, here we are creating an admin option which affects both.
comment:6 by , 13 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:9 by , 12 years ago
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 by , 12 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I'm with Luke: this isn't something we should change; the downsides outweigh the upsides.
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.