ImageField validation problem
form.cleaned_data[image_field].read() seems to be empty when validating with custom validation using newforms.
...
if hasattr(data, 'temporary_file_path'):
file = data.temporary_file_path()
else:
if hasattr(data, 'read'):
file = StringIO(data.read())
else:
file = StringIO(data['content'])
...
data.read() in the clean() method of ImageField becomes empty after the first read making the file unreadable in next custom validation.
Change History
(9)
Owner: |
changed from nobody to anonymous
|
Status: |
new → assigned
|
Triage Stage: |
Unreviewed → Accepted
|
Has patch: |
set
|
Keywords: |
2070-fix added
|
Owner: |
changed from anonymous to Michael Axiak
|
Status: |
assigned → new
|
Triage Stage: |
Accepted → Ready for checkin
|
Owner: |
changed from Michael Axiak to Jacob
|
Status: |
new → assigned
|
Cc: |
justin.driscoll@… added
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
With custom validation, I mean implementing the clean_fieldname() method in a form using newforms.