#9588: provide **kwargs argument to GenericInlineModelAdmin.get_formset
---------------------------------------------+------------------------------
 Reporter:  [EMAIL PROTECTED]  |       Owner:  nobody    
   Status:  new                              |   Milestone:            
Component:  Contrib apps                     |     Version:  1.0       
 Keywords:                                   |       Stage:  Unreviewed
Has_patch:  1                                |  
---------------------------------------------+------------------------------
 InlineModelAdmin.get_formset provides kwargs to override defaults:
 {{{
     def get_formset(self, request, obj=None, **kwargs):
         """Returns a BaseInlineFormSet class for use in admin add/change
 views."""
         if self.declared_fieldsets:
             fields = flatten_fieldsets(self.declared_fieldsets)
         else:
             fields = None
         if self.exclude is None:
             exclude = []
         else:
             exclude = self.exclude
         defaults = {
             "form": self.form,
             "formset": self.formset,
             "fk_name": self.fk_name,
             "fields": fields,
             "exclude": exclude + kwargs.get("exclude", []),
             "formfield_callback": self.formfield_for_dbfield,
             "extra": self.extra,
             "max_num": self.max_num,
         }
         defaults.update(kwargs)
         return inlineformset_factory(self.parent_model, self.model,
 **defaults)
 }}}

 Shouldn't we do the same for GenericInlineModelAdmin.get_formset ?

 Potential Patch:
 {{{
     def get_formset(self, request, obj=None, **kwargs):
         if self.declared_fieldsets:
             fields = flatten_fieldsets(self.declared_fieldsets)
         else:
             fields = None
         defaults = {
             "ct_field": self.ct_field,
             "fk_field": self.ct_fk_field,
             "form": self.form,
             "formfield_callback": self.formfield_for_dbfield,
             "formset": self.formset,
             "extra": self.extra,
             "can_delete": True,
             "can_order": False,
             "fields": fields,
         }
         defaults.update(kwargs)
         return generic_inlineformset_factory(self.model, **defaults)
 }}}

 I chose the "Contrib Apps" component because there is no
 "contrib.contenttypes".

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9588>
Django <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
-~----------~----~----~----~------~----~------~--~---

Reply via email to