diff options
Diffstat (limited to 'django/forms/fields.py')
| -rw-r--r-- | django/forms/fields.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/django/forms/fields.py b/django/forms/fields.py index c0ee2f0955..12316a1ab1 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -483,7 +483,12 @@ class ImageField(FileField): return None elif not data and initial: return initial - from PIL import Image + + # Try to import PIL in either of the two ways it can end up installed. + try: + from PIL import Image + except ImportError: + import Image # We need to get a file object for PIL. We might have a path or we might # have to read the data into memory. |
