Ticket #12346: 12346.diff

File 12346.diff, 4.2 KB (added by Tim Graham, 11 years ago)
  • docs/ref/contrib/admin/index.txt

    diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
    index 70db529..a22a51e 100644
    a b The ``InlineModelAdmin`` class adds:  
    17131713
    17141714.. attribute:: InlineModelAdmin.formset
    17151715
    1716     This defaults to ``BaseInlineFormSet``. Using your own formset can give you
    1717     many possibilities of customization. Inlines are built around
    1718     :ref:`model formsets <model-formsets>`.
     1716    This defaults to :class:`~django.forms.models.BaseInlineFormSet`. Using
     1717    your own formset can give you many possibilities of customization. Inlines
     1718    are built around :ref:`model formsets <model-formsets>`.
    17191719
    17201720.. attribute:: InlineModelAdmin.form
    17211721
    The ``InlineModelAdmin`` class adds:  
    17911791
    17921792.. method:: InlineModelAdmin.get_formset(self, request, obj=None, **kwargs)
    17931793
    1794     Returns a ``BaseInlineFormSet`` class for use in admin add/change views.
    1795     See the example for :class:`ModelAdmin.get_formsets`.
     1794    Returns a :class:`~django.forms.models.BaseInlineFormSet` class for use in
     1795    admin add/change views. See the example for
     1796    :class:`ModelAdmin.get_formsets`.
    17961797
    17971798.. method:: InlineModelAdmin.get_extra(self, request, obj=None, **kwargs)
    17981799
  • docs/ref/forms/models.txt

    diff --git a/docs/ref/forms/models.txt b/docs/ref/forms/models.txt
    index 840a896..1d2b468 100644
    a b Model Form Functions  
    6969.. function:: inlineformset_factory(parent_model, model, form=ModelForm, formset=BaseInlineFormSet, fk_name=None, fields=None, exclude=None, extra=3, can_order=False, can_delete=True, max_num=None, formfield_callback=None, widgets=None, validate_max=False, localized_fields=None, labels=None, help_texts=None, error_messages=None)
    7070
    7171    Returns an ``InlineFormSet`` using :func:`modelformset_factory` with
    72     defaults of ``formset=BaseInlineFormSet``, ``can_delete=True``, and
    73     ``extra=3``.
     72    defaults of ``formset=``:class:`~django.forms.models.BaseInlineFormSet`,
     73    ``can_delete=True``, and ``extra=3``.
    7474
    7575    If your model has more than one :class:`~django.db.models.ForeignKey` to
    7676    the ``parent_model``, you must specify a ``fk_name``.
  • docs/topics/forms/modelforms.txt

    diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt
    index d961ee4..381a97f 100644
    a b than that of a "normal" formset. The only difference is that we call  
    857857``formset.save()`` to save the data into the database. (This was described
    858858above, in :ref:`saving-objects-in-the-formset`.)
    859859
    860 Overiding ``clean()`` on a ``model_formset``
     860.. _model-formsets-overriding-clean:
     861
     862Overriding ``clean()`` on a ``ModelFormSet``
    861863--------------------------------------------
    862864
    863865Just like with ``ModelForms``, by default the ``clean()`` method of a
    864 ``model_formset`` will validate that none of the items in the formset violate
     866``ModelFormSet`` will validate that none of the items in the formset violate
    865867the unique constraints on your model (either ``unique``, ``unique_together`` or
    866868``unique_for_date|month|year``).  If you want to override the ``clean()`` method
    867 on a ``model_formset`` and maintain this validation, you must call the parent
     869on a ``ModelFormSet`` and maintain this validation, you must call the parent
    868870class's ``clean`` method::
    869871
    870872    from django.forms.models import BaseModelFormSet
    primary key that isn't called ``id``, make sure it gets rendered.)  
    969971Inline formsets
    970972===============
    971973
     974.. class:: models.BaseInlineFormSet
     975
    972976Inline formsets is a small abstraction layer on top of model formsets. These
    973977simplify the case of working with related objects via a foreign key. Suppose
    974978you have these two models::
    a particular author, you could do this::  
    10001004
    10011005    :ref:`Manually rendered can_delete and can_order <manually-rendered-can-delete-and-can-order>`.
    10021006
     1007Overriding ``clean()`` on an ``InlineFormSet``
     1008----------------------------------------------
     1009
     1010See :ref:`model-formsets-overriding-clean`, but subclass
     1011:class:`~models.BaseInlineFormSet` rather than
     1012:class:`~models.BaseModelFormSet`.
     1013
    10031014More than one foreign key to the same model
    10041015-------------------------------------------
    10051016
Back to Top