Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.6.x] Fixed #12346 -- Added a note on how to validate InlineFormSets.

Thanks johnsmith for the suggestion.

Backport of 181f63c from master
  • Loading branch information...
commit cf8d0933cb5bba3ce869f55cd423054d9c128956 1 parent 0a84cba
Tim Graham authored July 08, 2013
11  docs/ref/contrib/admin/index.txt
@@ -1713,9 +1713,9 @@ The ``InlineModelAdmin`` class adds:
1713 1713
 
1714 1714
 .. attribute:: InlineModelAdmin.formset
1715 1715
 
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>`.
1719 1719
 
1720 1720
 .. attribute:: InlineModelAdmin.form
1721 1721
 
@@ -1791,8 +1791,9 @@ The ``InlineModelAdmin`` class adds:
1791 1791
 
1792 1792
 .. method:: InlineModelAdmin.get_formset(self, request, obj=None, **kwargs)
1793 1793
 
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`.
1796 1797
 
1797 1798
 .. method:: InlineModelAdmin.get_extra(self, request, obj=None, **kwargs)
1798 1799
 
4  docs/ref/forms/models.txt
@@ -69,8 +69,8 @@ Model Form Functions
69 69
 .. 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)
70 70
 
71 71
     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``.
74 74
 
75 75
     If your model has more than one :class:`~django.db.models.ForeignKey` to
76 76
     the ``parent_model``, you must specify a ``fk_name``.
17  docs/topics/forms/modelforms.txt
@@ -857,14 +857,16 @@ than that of a "normal" formset. The only difference is that we call
857 857
 ``formset.save()`` to save the data into the database. (This was described
858 858
 above, in :ref:`saving-objects-in-the-formset`.)
859 859
 
860  
-Overiding ``clean()`` on a ``model_formset``
  860
+.. _model-formsets-overriding-clean:
  861
+
  862
+Overriding ``clean()`` on a ``ModelFormSet``
861 863
 --------------------------------------------
862 864
 
863 865
 Just 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
865 867
 the unique constraints on your model (either ``unique``, ``unique_together`` or
866 868
 ``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
  869
+on a ``ModelFormSet`` and maintain this validation, you must call the parent
868 870
 class's ``clean`` method::
869 871
 
870 872
     from django.forms.models import BaseModelFormSet
@@ -969,6 +971,8 @@ primary key that isn't called ``id``, make sure it gets rendered.)
969 971
 Inline formsets
970 972
 ===============
971 973
 
  974
+.. class:: models.BaseInlineFormSet
  975
+
972 976
 Inline formsets is a small abstraction layer on top of model formsets. These
973 977
 simplify the case of working with related objects via a foreign key. Suppose
974 978
 you have these two models::
@@ -1000,6 +1004,13 @@ a particular author, you could do this::
1000 1004
 
1001 1005
     :ref:`Manually rendered can_delete and can_order <manually-rendered-can-delete-and-can-order>`.
1002 1006
 
  1007
+Overriding ``clean()`` on an ``InlineFormSet``
  1008
+----------------------------------------------
  1009
+
  1010
+See :ref:`model-formsets-overriding-clean`, but subclass
  1011
+:class:`~models.BaseInlineFormSet` rather than
  1012
+:class:`~models.BaseModelFormSet`.
  1013
+
1003 1014
 More than one foreign key to the same model
1004 1015
 -------------------------------------------
1005 1016
 

0 notes on commit cf8d093

Please sign in to comment.
Something went wrong with that request. Please try again.