From 431ac45168e130a7f8b88549f2662cde6b455877 Mon Sep 17 00:00:00 2001 From: Dulmandakh Date: Fri, 9 Oct 2015 11:03:19 +0800 Subject: [PATCH] Update compat.py try to import guardian if it's in INSTALLED_APPS --- rest_framework/compat.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 5ca5da20e..1ef3e1751 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -81,8 +81,9 @@ except ImportError: # Fixes (#1712). We keep the try/except for the test suite. guardian = None try: - import guardian - import guardian.shortcuts # Fixes #1624 + if 'guardian' in settings.INSTALLED_APPS: + import guardian + import guardian.shortcuts # Fixes #1624 except ImportError: pass