diff --git a/requirements/requirements-optionals.txt b/requirements/requirements-optionals.txt index 411ca0aab9..3ada43ebd5 100644 --- a/requirements/requirements-optionals.txt +++ b/requirements/requirements-optionals.txt @@ -1,4 +1,4 @@ # Optional packages which may be used with REST framework. markdown==2.5.2 -django-guardian==1.2.5 +django-guardian==1.3.0 django-filter==0.10.0 diff --git a/rest_framework/filters.py b/rest_framework/filters.py index 36ce00476b..a5e06b574d 100644 --- a/rest_framework/filters.py +++ b/rest_framework/filters.py @@ -198,4 +198,7 @@ def filter_queryset(self, request, queryset, view): 'model_name': get_model_name(model_cls) } permission = self.perm_format % kwargs - return guardian.shortcuts.get_objects_for_user(user, permission, queryset) + if guardian.VERSION >= (1, 3): + # Maintain behavior compatibility with versions prior to 1.3 + extra = {'accept_global_perms': False} + return guardian.shortcuts.get_objects_for_user(user, permission, queryset, **extra)