[Django] #22855: BaseFormatSet.is_multipart() should not only consider the first Form

2 views
Skip to first unread message

Django

unread,
Jun 17, 2014, 3:20:25 PM6/17/14
to django-...@googlegroups.com
#22855: BaseFormatSet.is_multipart() should not only consider the first Form
----------------------------+--------------------
Reporter: mail@… | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
----------------------------+--------------------
I am constructing a FormSet consisting of forms which have fields
dynamically added in the __init__ method of the form (to add a FileField
only if no initial parameters are given).

However, it shows that BaseFormatSet.is_multipart() only considers the
first form of the form set which causes my FormSet to fail if a FileField
exists in some forms of the form set, but no in the first one.

Of course, I can solve my problem by implementing is_multipart() by myself
but this seems like an ugly workaround. In my opinion,
BaseFormatSet.is_multipart() should check all forms of the form set
whether any of them contains a field which requires multipart encoding.

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

Django

unread,
Jun 17, 2014, 3:21:11 PM6/17/14
to django-...@googlegroups.com
#22855: BaseFormSet.is_multipart() should not only consider the first Form
------------------------+--------------------------------------

Reporter: mail@… | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
------------------------+--------------------------------------
Changes (by anonymous):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


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

Django

unread,
Jun 17, 2014, 3:30:04 PM6/17/14
to django-...@googlegroups.com
#22855: BaseFormSet.is_multipart() should not only consider the first Form
------------------------+--------------------------------------
Reporter: mail@… | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.6
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
------------------------+--------------------------------------
Changes (by timo):

* status: new => closed
* resolution: => wontfix


Comment:

I tend to think it's better for you to override it for your use case
rather than impose the performance penalty of iterating through all forms
on all users. There are similar assumptions in `BaseFormSet`, like the
`media` property, that assume all forms will be identical.

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

Reply all
Reply to author
Forward
0 new messages