Skip to content

Commit 743e757

Browse files
committed
Merge pull request #3184 from damycra/version-2.4.x
Support Django Guardian 1.3
2 parents 86f7967 + 59be95a commit 743e757

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rest_framework/filters.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,9 @@ 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+
else:
195+
extra = {}
196+
return guardian.shortcuts.get_objects_for_user(user, permission, queryset, **extra)

0 commit comments

Comments
 (0)