[Django] #20872: Bad error message if INITIAL_FORMS/TOTAL_FORMS > MAX_NUM_FORMS

5 views
Skip to first unread message

Django

unread,
Aug 6, 2013, 11:12:39 PM8/6/13
to django-...@googlegroups.com
#20872: Bad error message if INITIAL_FORMS/TOTAL_FORMS > MAX_NUM_FORMS
------------------------------------+------------------------
Reporter: russellm | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.5
Severity: Normal | Keywords:
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------+------------------------
Formset handling currently enforces a MAX_NUM_FORMS check on incoming form
data. However, there is no checking or validation that MAX_NUM_FORMS is
actually equal to or greater than INITIAL_FORMS/TOTAL_FORMS.

As a result, it's possible to construct and display a formset, but then
have that formset fail (with a "list index out of range error") on form
submission.

This manifested for me as the following: A model in the admin with
inlines; the inline was filled with 2023 inline objects, and the default
MAX_NUM_FORMS (1000 was in use. The page takes a long time to load, but it
*does* load; when you hit submit, you get the "list index out of range"
error as a 500 page, with no suggestion of the underlying problem.

I haven't tested, but AFAICT, the same problem will manifest with a lot
less data if you set MAX_NUM_FORMS to a lower value.

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

Django

unread,
Sep 7, 2013, 12:23:40 PM9/7/13
to django-...@googlegroups.com
#20872: Bad error message if INITIAL_FORMS/TOTAL_FORMS > MAX_NUM_FORMS
--------------------------+------------------------------------
Reporter: russellm | Owner: mburst
Type: Bug | Status: assigned
Component: Forms | Version: 1.5
Severity: Normal | Resolution:

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------+------------------------------------
Changes (by mburst):

* status: new => assigned
* owner: nobody => mburst


--
Ticket URL: <https://code.djangoproject.com/ticket/20872#comment:1>

Django

unread,
Sep 7, 2013, 2:07:33 PM9/7/13
to django-...@googlegroups.com
#20872: Bad error message if INITIAL_FORMS/TOTAL_FORMS > MAX_NUM_FORMS
--------------------------+--------------------------------------
Reporter: russellm | Owner: mburst
Type: Bug | Status: closed
Component: Forms | Version: 1.5
Severity: Normal | Resolution: worksforme

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------+--------------------------------------
Changes (by mburst):

* status: assigned => closed
* resolution: => worksforme


Comment:

This has been fixed with commit
https://github.com/django/django/commit/f9ab543720532400e8b0d490cdbe67ea09ae9c17.
total_form_count can't be larger than absolute_max.

--
Ticket URL: <https://code.djangoproject.com/ticket/20872#comment:2>

Django

unread,
Sep 7, 2013, 2:08:37 PM9/7/13
to django-...@googlegroups.com
#20872: Bad error message if INITIAL_FORMS/TOTAL_FORMS > MAX_NUM_FORMS
--------------------------+------------------------------------

Reporter: russellm | Owner: mburst
Type: Bug | Status: closed
Component: Forms | Version: 1.5
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------+------------------------------------
Changes (by mburst):

* resolution: worksforme => fixed


--
Ticket URL: <https://code.djangoproject.com/ticket/20872#comment:3>

Reply all
Reply to author
Forward
0 new messages