Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.1.X] Fixed #11908 -- Clarified the role and usage of the Managemen…

…tForm in formsets. Thanks to timo for the draft patch.

Backport of r13222 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@13227 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 08de7a32d9a8eb790bfae52e1d9295e2436b03b3 1 parent a0ea98e
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
@@ -123,10 +123,12 @@ the expected error message appears for the second item.
123 123
 Understanding the ManagementForm
124 124
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125 125
 
126  
-You may have noticed the additional data that was required in the formset's
127  
-data above. This data is coming from the ``ManagementForm``. This form is
128  
-dealt with internally to the formset. If you don't use it, it will result in
129  
-an exception::
  126
+You may have noticed the additional data (``form-TOTAL_FORMS`` and
  127
+``form-INITIAL_FORMS``) that was required in the formset's data above.
  128
+This data is required for the ``ManagementForm``. This form is used by
  129
+the formset to manage the collection of forms contained in the
  130
+formset. If you don't provide this management data, an exception will
  131
+be raised::
130 132
 
131 133
     >>> data = {
132 134
     ...     'form-0-title': u'Test',
@@ -141,6 +143,11 @@ It is used to keep track of how many form instances are being displayed. If
141 143
 you are adding new forms via JavaScript, you should increment the count fields
142 144
 in this form as well.
143 145
 
  146
+The management form is available as an attribute of the formset
  147
+itself. When rendering a formset in a template, you can include all
  148
+the management data by rendering ``{{ my_formset.management_form }}``
  149
+(substituting the name of your formset as appropriate).
  150
+
144 151
 .. versionadded:: 1.1
145 152
 
146 153
 ``total_form_count`` and ``initial_form_count``

0 notes on commit 08de7a3

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