Update compat.py

try to import guardian if it's in INSTALLED_APPS
This commit is contained in:
Dulmandakh 2015-10-09 11:03:19 +08:00
parent 85cd717ec0
commit 431ac45168

View File

@ -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