Skip to content

Commit 788aae2

Browse files
committed
Upgrade guardian support to 1.3. Closes #3163.
1 parent 7b21336 commit 788aae2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Optional packages which may be used with REST framework.
22
markdown==2.5.2
3-
django-guardian==1.2.5
3+
django-guardian==1.3.0
44
django-filter==0.10.0

rest_framework/filters.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,7 @@ def filter_queryset(self, request, queryset, view):
198198
'model_name': get_model_name(model_cls)
199199
}
200200
permission = self.perm_format % kwargs
201-
return guardian.shortcuts.get_objects_for_user(user, permission, queryset)
201+
if guardian.VERSION >= (1, 3):
202+
# Maintain behavior compatibility with versions prior to 1.3
203+
extra = {'accept_global_perms': False}
204+
return guardian.shortcuts.get_objects_for_user(user, permission, queryset, **extra)

0 commit comments

Comments
 (0)