0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Fixed #12505 -- Clarified the use of the extra argument in formsets. Thanks to Andreas for the report, and timo for the draft patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13218 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2010-05-10 14:03:11 +00:00
parent 9f230c7eeb
commit a44b10dba7

View File

@ -29,9 +29,10 @@ would with a regular form::
<tr><th><label for="id_form-0-title">Title:</label></th><td><input type="text" name="form-0-title" id="id_form-0-title" /></td></tr> <tr><th><label for="id_form-0-title">Title:</label></th><td><input type="text" name="form-0-title" id="id_form-0-title" /></td></tr>
<tr><th><label for="id_form-0-pub_date">Pub date:</label></th><td><input type="text" name="form-0-pub_date" id="id_form-0-pub_date" /></td></tr> <tr><th><label for="id_form-0-pub_date">Pub date:</label></th><td><input type="text" name="form-0-pub_date" id="id_form-0-pub_date" /></td></tr>
As you can see it only displayed one form. This is because by default the As you can see it only displayed one empty form. The number of empty forms
``formset_factory`` defines one extra form. This can be controlled with the that is displayed is controlled by the ``extra`` parameter. By default,
``extra`` parameter:: ``formset_factory`` defines one extra form; the following example will
display two blank forms::
>>> ArticleFormSet = formset_factory(ArticleForm, extra=2) >>> ArticleFormSet = formset_factory(ArticleForm, extra=2)