Opened 7 years ago

Closed 7 years ago

Last modified 6 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: UI/UX:

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 7 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)

Changed 7 years ago by sureshkannan

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

comment:1 Changed 7 years ago by garcia_marc

  • milestone changed from 1.0 alpha to post-1.0
  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 7 years ago by jarrow

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

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

comment:3 Changed 6 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

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