Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Improved model validator so that it checks for PIL if ImageFields are…

… used

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 530cdb5 commit 26c4356e015d7087ed9f5393421623224cb055b2 @adrianholovaty adrianholovaty committed
Showing with 5 additions and 0 deletions.
  1. +5 −0 django/core/
5 django/core/
@@ -524,6 +524,11 @@ def get_validation_errors(outfile):
e.add(opts, '"%s" field: CharFields require a "maxlength" attribute.' %
if isinstance(f, meta.FileField) and not f.upload_to:
e.add(opts, '"%s" field: FileFields require an "upload_to" attribute.' %
+ if isinstance(f, meta.ImageField):
+ try:
+ from PIL import Image
+ except ImportError:
+ e.add(opts, '"%s" field: To use ImageFields, you need to install the Python Imaging Library. Get it at .')
if f.prepopulate_from is not None and type(f.prepopulate_from) not in (list, tuple):
e.add(opts, '"%s" field: prepopulate_from should be a list or tuple.' %
if f.choices:

0 comments on commit 26c4356

Please sign in to comment.
Something went wrong with that request. Please try again.