Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #11908 -- Clarified the role and usage of the ManagementForm in…

… formsets. Thanks to timo for the draft patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13222 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 101571b940123deaf3d9dc2a32381ad2fe151d71 1 parent bc82e20
Russell Keith-Magee authored May 10, 2010

Showing 1 changed file with 11 additions and 4 deletions. Show diff stats Hide diff stats

  1. 15  docs/topics/forms/formsets.txt
15  docs/topics/forms/formsets.txt
@@ -136,10 +136,12 @@ the expected error message appears for the second item.
136 136
 Understanding the ManagementForm
137 137
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
138 138
 
139  
-You may have noticed the additional data that was required in the formset's
140  
-data above. This data is coming from the ``ManagementForm``. This form is
141  
-dealt with internally to the formset. If you don't use it, it will result in
142  
-an exception::
  139
+You may have noticed the additional data (``form-TOTAL_FORMS``,
  140
+``form-INITIAL_FORMS`` and ``form-MAX_NUM_FORMS``) that was required
  141
+in the formset's data above. This data is required for the
  142
+``ManagementForm``. This form is used by the formset to manage the
  143
+collection of forms contained in the formset. If you don't provide
  144
+this management data, an exception will be raised::
143 145
 
144 146
     >>> data = {
145 147
     ...     'form-0-title': u'Test',
@@ -154,6 +156,11 @@ It is used to keep track of how many form instances are being displayed. If
154 156
 you are adding new forms via JavaScript, you should increment the count fields
155 157
 in this form as well.
156 158
 
  159
+The management form is available as an attribute of the formset
  160
+itself. When rendering a formset in a template, you can include all
  161
+the management data by rendering ``{{ my_formset.management_form }}``
  162
+(substituting the name of your formset as appropriate).
  163
+
157 164
 .. versionadded:: 1.1
158 165
 
159 166
 ``total_form_count`` and ``initial_form_count``

0 notes on commit 101571b

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