Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#7703 closed (duplicate)

ModelAdmin.get_fieldsets calls ModelAdmin.get_form without the obj parameter

Reported by: sureshkannan Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Keywords: get_form, ModelAdmin
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When subclassing ModelAdmin to generate different forms depending on a field in an existing object or a parameter in request.GET, then he/she needs to override ModelAdmin.get_form(self,request,obj=None).

ModelAdmin.get_form}} is called in multiple places but when it is called from get_fieldsets the obj parameter is not passed to the get_form function. obj=None appears in the parameter list of get_fieldsets, so the simple fix is to change from {{{get_form(request) to get_form(request,obj) in the ModelAdmin.get_fieldsets function.

Attachments (1)

patch.txt (560 bytes ) - added by sureshkannan 16 years ago.
this is a one line (4 characters) change probably easier to just type it in

Download all attachments as: .zip

Change History (4)

by sureshkannan, 16 years ago

Attachment: patch.txt added

this is a one line (4 characters) change probably easier to just type it in

comment:1 by Marc Garcia, 16 years ago

milestone: 1.0 alphapost-1.0
Needs tests: set
Triage Stage: UnreviewedDesign decision needed

comment:2 by , 16 years ago

Resolution: duplicate
Status: newclosed

Closing as this is now a duplicate of #8367 which got accepted and even has a Milestone of 1.0

comment:3 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

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