We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 59a5a5a commit 5e5c27eCopy full SHA for 5e5c27e
rest_framework/compat.py
@@ -168,7 +168,12 @@ def is_guardian_installed():
168
"""
169
django-guardian is optional and only imported if in INSTALLED_APPS.
170
171
- if six.PY2:
+ try:
172
+ import guardian
173
+ except ImportError:
174
+ guardian = None
175
+
176
+ if six.PY2 and (not guardian or guardian.VERSION >= (1, 5)):
177
# Guardian 1.5.0, for Django 2.2 is NOT compatible with Python 2.7.
178
# Remove when dropping PY2.
179
return False
0 commit comments