Ticket #8069: ticket8069-1.diff

File ticket8069-1.diff, 2.9 KB (added by dan, 16 years ago)

patch addressing inconsistent case of BaseInlineFormSet

  • django/forms/models.py

     
    399399
    400400# InlineFormSets #############################################################
    401401
    402 class BaseInlineFormset(BaseModelFormSet):
     402class BaseInlineFormSet(BaseModelFormSet):
    403403    """A formset for child objects related to a parent."""
    404404    def __init__(self, data=None, files=None, instance=None,
    405405                 save_as_new=False, prefix=None):
     
    408408        self.save_as_new = save_as_new
    409409        # is there a better way to get the object descriptor?
    410410        self.rel_name = RelatedObject(self.fk.rel.to, self.model, self.fk).get_accessor_name()
    411         super(BaseInlineFormset, self).__init__(data, files, prefix=prefix or self.rel_name)
     411        super(BaseInlineFormSet, self).__init__(data, files, prefix=prefix or self.rel_name)
    412412   
    413413    def _construct_forms(self):
    414414        if self.save_as_new:
    415415            self._total_form_count = self._initial_form_count
    416416            self._initial_form_count = 0
    417         super(BaseInlineFormset, self)._construct_forms()
     417        super(BaseInlineFormSet, self)._construct_forms()
    418418
    419419    def get_queryset(self):
    420420        """
     
    465465
    466466
    467467def inlineformset_factory(parent_model, model, form=ModelForm,
    468                           formset=BaseInlineFormset, fk_name=None,
     468                          formset=BaseInlineFormSet, fk_name=None,
    469469                          fields=None, exclude=None,
    470470                          extra=3, can_order=False, can_delete=True, max_num=0,
    471471                          formfield_callback=lambda f: f.formfield()):
  • django/contrib/admin/options.py

     
    11from django import forms, template
    22from django.forms.formsets import all_valid
    33from django.forms.models import modelform_factory, inlineformset_factory
    4 from django.forms.models import BaseInlineFormset
     4from django.forms.models import BaseInlineFormSet
    55from django.contrib.contenttypes.models import ContentType
    66from django.contrib.admin import widgets
    77from django.contrib.admin.util import quote, unquote, get_deleted_objects
     
    711711    """
    712712    model = None
    713713    fk_name = None
    714     formset = BaseInlineFormset
     714    formset = BaseInlineFormSet
    715715    extra = 3
    716716    max_num = 0
    717717    template = None
  • docs/admin.txt

     
    548548``formset``
    549549~~~~~~~~~~~
    550550
    551 This defaults to ``BaseInlineFormset``. Using your own formset can give you
     551This defaults to ``BaseInlineFormSet``. Using your own formset can give you
    552552many possibilities of customization. Inlines are built around
    553553`model formsets`_.
    554554
Back to Top