ImageFields now include PIL error messages if invalid error (#353)
This commit is contained in:
parent
a246154961
commit
e5648a4af9
3 changed files with 14 additions and 2 deletions
|
|
@ -1259,8 +1259,8 @@ class ImageGridFsProxy(GridFSProxy):
|
|||
try:
|
||||
img = Image.open(file_obj)
|
||||
img_format = img.format
|
||||
except:
|
||||
raise ValidationError('Invalid image')
|
||||
except Exception, e:
|
||||
raise ValidationError('Invalid image: %s' % e)
|
||||
|
||||
if (field.size and (img.size[0] > field.size['width'] or
|
||||
img.size[1] > field.size['height'])):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue