Django

Code

Changeset 685

Show
Ignore:
Timestamp:
09/25/05 15:01:30 (3 years ago)
Author:
adrian
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/management.py

    r682 r685  
    525525                if isinstance(f, meta.FileField) and not f.upload_to: 
    526526                    e.add(opts, '"%s" field: FileFields require an "upload_to" attribute.' % f.name) 
     527                if isinstance(f, meta.ImageField): 
     528                    try: 
     529                        from PIL import Image 
     530                    except ImportError: 
     531                        e.add(opts, '"%s" field: To use ImageFields, you need to install the Python Imaging Library. Get it at http://www.pythonware.com/products/pil/ .') 
    527532                if f.prepopulate_from is not None and type(f.prepopulate_from) not in (list, tuple): 
    528533                    e.add(opts, '"%s" field: prepopulate_from should be a list or tuple.' % f.name)