diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-06-27 01:24:52 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-06-27 01:24:52 +0200 |
commit | 29d436259c7557132dcc13dee73e940129df93eb (patch) | |
tree | 83e77be45d11e6e08600b3eed3805ccc1ccf8389 /tests/djapp/models.py | |
parent | 1a24cf43576a18eaf8b7b7a836ca4ebb7d445148 (diff) | |
download | factory-boy-29d436259c7557132dcc13dee73e940129df93eb.tar factory-boy-29d436259c7557132dcc13dee73e940129df93eb.tar.gz |
Get safe against missing PIL.
Diffstat (limited to 'tests/djapp/models.py')
-rw-r--r-- | tests/djapp/models.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/djapp/models.py b/tests/djapp/models.py index 7bb5ace..cc34643 100644 --- a/tests/djapp/models.py +++ b/tests/djapp/models.py @@ -24,6 +24,14 @@ import os.path +try: + from PIL import Image +except ImportError: + try: + import Image + except ImportError: + Image = None + from django.conf import settings from django.db import models @@ -43,7 +51,11 @@ class WithFile(models.Model): afile = models.FileField(upload_to=WITHFILE_UPLOAD_TO) +if Image is not None: # PIL is available -class WithImage(models.Model): - animage = models.ImageField(upload_to=WITHFILE_UPLOAD_TO) + class WithImage(models.Model): + animage = models.ImageField(upload_to=WITHFILE_UPLOAD_TO) +else: + class WithImage(models.Model): + pass |