aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/compat.py
diff options
context:
space:
mode:
authorXavier Ordoquy2013-01-02 16:09:21 +0100
committerXavier Ordoquy2013-01-02 16:09:21 +0100
commit737349d2389197d23886b72c1cb44f53c501ac9a (patch)
tree0c542b6c73deee0280705c8253334126c5f5d254 /rest_framework/compat.py
parent5fad46d7e213afed503b1533515cab96875a5936 (diff)
parentd379997aba5b1e41309bbed8740ed704c0feb58b (diff)
downloaddjango-rest-framework-737349d2389197d23886b72c1cb44f53c501ac9a.tar.bz2
Merge remote-tracking branch 'reference/py3k' into p3k
Diffstat (limited to 'rest_framework/compat.py')
-rw-r--r--rest_framework/compat.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/rest_framework/compat.py b/rest_framework/compat.py
index 6ffada48..d5a9d995 100644
--- a/rest_framework/compat.py
+++ b/rest_framework/compat.py
@@ -8,6 +8,12 @@ import six
import django
+# location of patterns, url, include changes in 1.4 onwards
+try:
+ from django.conf.urls import patterns, url, include
+except:
+ from django.conf.urls.defaults import patterns, url, include
+
# django-filter is optional
try:
import django_filters
@@ -24,6 +30,16 @@ except ImportError:
from six import BytesIO
+# Try to import PIL in either of the two ways it can end up installed.
+try:
+ from PIL import Image
+except ImportError:
+ try:
+ import Image
+ except ImportError:
+ Image = None
+
+
def get_concrete_model(model_cls):
try:
return model_cls._meta.concrete_model