#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)
Change History (4)
by , 16 years ago
comment:1 by , 16 years ago
milestone: | 1.0 alpha → post-1.0 |
---|---|
Needs tests: | set |
Triage Stage: | Unreviewed → Design decision needed |
comment:2 by , 16 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Closing as this is now a duplicate of #8367 which got accepted and even has a Milestone of 1.0
this is a one line (4 characters) change probably easier to just type it in