Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#8400 closed (duplicate)

ModelAdmin.get_fieldsets call to get_form should include the obj parameter

Reported by: sureshkannan Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords: ModelAdmin.get_fieldsets
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

In ModelAdmin.get_fieldsets

form=self.get_form(request)

should be changed to
form=self.get_form(request,obj)

If get_form has been overridden to generate different forms based on a field in the obj
then the obj parameter must be passed in. This seems to be done correctly in the
formset counterpart ModelAdmin.get_formsets where inline.get_formset is called
with the obj parameter.

Change History (2)

comment:1 Changed 8 years ago by

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: duplicate
Status: newclosed

This is a duplicate of #8367 But I admit your title is much better ;)

comment:2 Changed 5 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

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