=== modified file 'django/newforms/forms.py'
|
|
|
210 | 210 | """ |
211 | 211 | return self.cleaned_data |
212 | 212 | |
| 213 | def is_multipart(self): |
| 214 | for field in self.fields.values(): |
| 215 | if field.widget.needs_multipart_form: |
| 216 | return True |
| 217 | return False |
| 218 | |
213 | 219 | class Form(BaseForm): |
214 | 220 | "A collection of Fields, plus their associated data." |
215 | 221 | # This is a separate class from BaseForm in order to abstract the way |
=== modified file 'django/newforms/widgets.py'
|
|
|
24 | 24 | |
25 | 25 | class Widget(object): |
26 | 26 | is_hidden = False # Determines whether this corresponds to an <input type="hidden">. |
| 27 | needs_multipart_form = False |
27 | 28 | |
28 | 29 | def __init__(self, attrs=None): |
29 | 30 | if attrs is not None: |
… |
… |
|
120 | 121 | |
121 | 122 | class FileInput(Input): |
122 | 123 | input_type = 'file' |
| 124 | needs_multipart_form = True |
123 | 125 | |
124 | 126 | def render(self, name, value, attrs=None): |
125 | 127 | return super(FileInput, self).render(name, None, attrs=attrs) |