Author: kmtracey Date: 2009-05-18 11:00:29 -0500 (Mon, 18 May 2009) New Revision: 10819
Modified: django/trunk/docs/topics/forms/modelforms.txt Log: Fixed #11138 -- Corrected the description of behavior related to the max_num parameter for model formsets. Modified: django/trunk/docs/topics/forms/modelforms.txt =================================================================== --- django/trunk/docs/topics/forms/modelforms.txt 2009-05-18 15:36:18 UTC (rev 10818) +++ django/trunk/docs/topics/forms/modelforms.txt 2009-05-18 16:00:29 UTC (rev 10819) @@ -552,7 +552,7 @@ As with regular formsets, you can use the ``max_num`` parameter to ``modelformset_factory`` to limit the number of forms displayed. With -model formsets, this properly limits the query to select only the maximum +model formsets, this property limits the query to select only the maximum number of objects needed:: >>> Author.objects.order_by('name') @@ -563,10 +563,11 @@ >>> formset.initial [{'id': 1, 'name': u'Charles Baudelaire'}, {'id': 3, 'name': u'Paul Verlaine'}] -If the value of ``max_num`` is less than the total objects returned, the -formset will fill the rest with extra forms:: +If the value of ``max_num`` is higher than the number of objects returned, up to +``extra`` additional blank forms will be added to the formset, so long as the +total number of forms does not exceed ``max_num``:: - >>> AuthorFormSet = modelformset_factory(Author, max_num=4, extra=1) + >>> AuthorFormSet = modelformset_factory(Author, max_num=4, extra=2) >>> formset = AuthorFormSet(queryset=Author.objects.order_by('name')) >>> for form in formset.forms: ... print form.as_table() --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@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 -~----------~----~----~----~------~----~------~--~---