Author: russellm Date: 2010-05-10 09:17:16 -0500 (Mon, 10 May 2010) New Revision: 13227
Modified: django/branches/releases/1.1.X/docs/topics/forms/formsets.txt Log: [1.1.X] Fixed #11908 -- Clarified the role and usage of the ManagementForm in formsets. Thanks to timo for the draft patch. Backport of r13222 from trunk. Modified: django/branches/releases/1.1.X/docs/topics/forms/formsets.txt =================================================================== --- django/branches/releases/1.1.X/docs/topics/forms/formsets.txt 2010-05-10 14:16:04 UTC (rev 13226) +++ django/branches/releases/1.1.X/docs/topics/forms/formsets.txt 2010-05-10 14:17:16 UTC (rev 13227) @@ -123,10 +123,12 @@ Understanding the ManagementForm ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -You may have noticed the additional data that was required in the formset's -data above. This data is coming from the ``ManagementForm``. This form is -dealt with internally to the formset. If you don't use it, it will result in -an exception:: +You may have noticed the additional data (``form-TOTAL_FORMS`` and +``form-INITIAL_FORMS``) that was required in the formset's data above. +This data is required for the ``ManagementForm``. This form is used by +the formset to manage the collection of forms contained in the +formset. If you don't provide this management data, an exception will +be raised:: >>> data = { ... 'form-0-title': u'Test', @@ -141,6 +143,11 @@ you are adding new forms via JavaScript, you should increment the count fields in this form as well. +The management form is available as an attribute of the formset +itself. When rendering a formset in a template, you can include all +the management data by rendering ``{{ my_formset.management_form }}`` +(substituting the name of your formset as appropriate). + .. versionadded:: 1.1 ``total_form_count`` and ``initial_form_count`` -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.