From 190f6201cbbac18803479020dae922c5ae3e90f2 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Thu, 31 Jan 2019 15:59:19 +0100 Subject: [PATCH] Update Django Guardian dependency. (#6430) * Update Django Guardian dependency. * Skip testing Guardian on PY2. See https://github.com/django-guardian/django-guardian/issues/602 --- requirements/requirements-optionals.txt | 2 +- rest_framework/compat.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/requirements/requirements-optionals.txt b/requirements/requirements-optionals.txt index cd0f1f62b..c800a5891 100644 --- a/requirements/requirements-optionals.txt +++ b/requirements/requirements-optionals.txt @@ -1,7 +1,7 @@ # Optional packages which may be used with REST framework. psycopg2-binary==2.7.5 markdown==2.6.11 -django-guardian==1.4.9 +django-guardian==1.5.0 django-filter==1.1.0 coreapi==2.3.1 coreschema==0.0.4 diff --git a/rest_framework/compat.py b/rest_framework/compat.py index fffc17938..5a4bcdf66 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -161,6 +161,10 @@ def is_guardian_installed(): """ django-guardian is optional and only imported if in INSTALLED_APPS. """ + if six.PY2: + # Guardian 1.5.0, for Django 2.2 is NOT compatible with Python 2.7. + # Remove when dropping PY2. + return False return 'guardian' in settings.INSTALLED_APPS