diff --git a/dj_elastictranscoder/models.py b/dj_elastictranscoder/models.py index 8422e07..1c2a03c 100644 --- a/dj_elastictranscoder/models.py +++ b/dj_elastictranscoder/models.py @@ -1,9 +1,10 @@ from django.db import models from django.contrib.contenttypes.models import ContentType import django -if django.get_version() >= '1.8': + +try: from django.contrib.contenttypes.fields import GenericForeignKey -else: +except ImportError: from django.contrib.contenttypes.generic import GenericForeignKey diff --git a/dj_elastictranscoder/urls.py b/dj_elastictranscoder/urls.py index 3b6d4a3..0299d2f 100644 --- a/dj_elastictranscoder/urls.py +++ b/dj_elastictranscoder/urls.py @@ -1,8 +1,18 @@ +import django + +from dj_elastictranscoder.views import endpoint as transcoder_endpoint + try: from django.conf.urls import url, patterns except ImportError: - from django.conf.urls.defaults import url, patterns # Support for Django < 1.4 + try: + from django.conf.urls.defaults import url, patterns # Support for Django < 1.4 + except ImportError: + from django.conf.urls import url -urlpatterns = patterns('dj_elastictranscoder.views', - url(r'^endpoint/$', 'endpoint'), -) +if django.VERSION[0] >= 1 and django.VERSION[1] >= 10: + urlpatterns = (url(r'^endpoint/$', transcoder_endpoint, name='transcoder_endpoint'),) +else: + urlpatterns = patterns('dj_elastictranscoder.views', + url(r'^endpoint/$', 'endpoint'), + )