From efa9ff298598aac9dbe99a5c15c87c434b4aeee2 Mon Sep 17 00:00:00 2001 From: Lukasz Karolewski Date: Thu, 20 Oct 2016 13:30:01 -0700 Subject: [PATCH] changing order of imports 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 --- rest_framework/compat.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 7ec39ba634..2d6e7843ca 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -170,6 +170,16 @@ def value_from_object(field, obj): 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 @@ def value_from_object(field, obj): 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 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy