#20347: Creating a formset with more than max_num forms
-------------------------------+--------------------
     Reporter:  CarstenF       |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Forms          |    Version:  1.5
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 The documentation at
 https://docs.djangoproject.com/en/1.5/topics/forms/formsets/#limiting-the-
 maximum-number-of-forms seems to indicate (if I understood it correctly)
 that the purpose of the `max_num` parameter is to prevent that someone
 sends a manipulated, excessively large value in the hidden form field that
 states the number of (extra) forms that are submitted, whereas it is not
 (directly) related to the number of forms that are //actually// POSTed, or
 initialized via parameter `initials`.

 However, following the example at that page, with `MyInitials` being a
 list of e.g. 1500 initial values and `request.POST` containing more than
 1500 formsets:

 {{{
 #!python
 >>> ArticleFormSet = formset_factory(ArticleForm, extra=0)
 >>> formset1 = ArticleFormSet(initial=MyInitials)
 >>> formset2 = ArticleFormSet(request.POST)
 }}}

 Now, accessing `formset1.forms[1000]` throws an IndexError exception.

 The `max_num` is at its default value of 1000, but in the above context,
 it is not expected that `formset1` or `formset2` is reduced to `max_num`
 forms -- I'd have expected each to have the full number of forms as
 initialized.

 Related thread at django-users:
 http://thread.gmane.org/gmane.comp.python.django.user/152946

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20347>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to