=== modified file 'django/newforms/fields.py'
|
|
|
|
| 350 | 350 | |
| 351 | 351 | class UploadedFile(StrAndUnicode): |
| 352 | 352 | "A wrapper for files uploaded in a FileField" |
| 353 | | def __init__(self, filename, content): |
| | 353 | def __init__(self, filename, content, content_type): |
| 354 | 354 | self.filename = filename |
| 355 | 355 | self.content = content |
| | 356 | self.content_type = content_type |
| 356 | 357 | |
| 357 | 358 | def __unicode__(self): |
| 358 | 359 | """ |
| … |
… |
|
| 371 | 372 | if not self.required and data in EMPTY_VALUES: |
| 372 | 373 | return None |
| 373 | 374 | try: |
| 374 | | f = UploadedFile(data['filename'], data['content']) |
| | 375 | f = UploadedFile(data['filename'], data['content'], data['content-type']) |
| 375 | 376 | except TypeError: |
| 376 | 377 | raise ValidationError(ugettext(u"No file was submitted. Check the encoding type on the form.")) |
| 377 | 378 | except KeyError: |