Skip to content

Commit 152035a

Browse files
tomchristiedamycra
authored andcommitted
Cherry picks
Upgrade guardian support to 1.3. #3165
1 parent 86f7967 commit 152035a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rest_framework/filters.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,7 @@ def filter_queryset(self, request, queryset, view):
188188
'model_name': get_model_name(model_cls)
189189
}
190190
permission = self.perm_format % kwargs
191-
return guardian.shortcuts.get_objects_for_user(user, permission, queryset)
191+
if guardian.VERSION >= (1, 3):
192+
# Maintain behavior compatibility with versions prior to 1.3
193+
extra = {'accept_global_perms': False}
194+
return guardian.shortcuts.get_objects_for_user(user, permission, queryset, **extra)

0 commit comments

Comments
 (0)