mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-10 19:56:59 +03:00
Fix #1712 (issue when django-guardian is installed but not configured/used)
This commit is contained in:
parent
299a8347e8
commit
fe048dc4fb
|
@ -48,12 +48,15 @@ try:
|
|||
except ImportError:
|
||||
django_filters = None
|
||||
|
||||
# guardian is optional
|
||||
try:
|
||||
import guardian
|
||||
import guardian.shortcuts # Fixes #1624
|
||||
except ImportError:
|
||||
guardian = None
|
||||
# Django-guardian is optional. Import only if guardian is in INSTALLED_APPS
|
||||
# Fixes (#1712). We keep the try/except for the test suite.
|
||||
guardian = None
|
||||
if 'guardian' in settings.INSTALLED_APPS:
|
||||
try:
|
||||
import guardian
|
||||
import guardian.shortcuts # Fixes #1624
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
# cStringIO only if it's available, otherwise StringIO
|
||||
|
|
Loading…
Reference in New Issue
Block a user