#7703: ModelAdmin.get_fieldsets calls ModelAdmin.get_form without the obj
parameter
----------------------------------+-----------------------------------------
Reporter: sureshkannan | Owner: nobody
Status: new | Milestone: 1.0 alpha
Component: Admin interface | Version: newforms-admin
Keywords: get_form, ModelAdmin | Stage: Unreviewed
Has_patch: 1 |
----------------------------------+-----------------------------------------
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.
--
Ticket URL: <http://code.djangoproject.com/ticket/7703>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---