changing order of imports (#4601)

when using with django-filter and rest_framework_swagger need to import coreapi before django-filter as django filter tries to load rest_framework.coreapi which is undefined at this point
This commit is contained in:
Lukasz Karolewski 2016-10-21 07:00:25 -07:00 committed by Tom Christie
parent e3686aca93
commit 0b346e94b1

View File

@ -170,6 +170,16 @@ except ImportError:
JSONField = None
# coreapi is optional (Note that uritemplate is a dependency of coreapi)
try:
import coreapi
import uritemplate
except (ImportError, SyntaxError):
# SyntaxError is possible under python 3.2
coreapi = None
uritemplate = None
# django-filter is optional
try:
import django_filters
@ -184,16 +194,6 @@ except ImportError:
crispy_forms = None
# coreapi is optional (Note that uritemplate is a dependency of coreapi)
try:
import coreapi
import uritemplate
except (ImportError, SyntaxError):
# SyntaxError is possible under python 3.2
coreapi = None
uritemplate = None
# requests is optional
try:
import requests