Cherry picks

Upgrade guardian support to 1.3. #3165
This commit is contained in:
Tom Christie 2015-07-16 16:46:07 +01:00 committed by Steven Davidson
parent 86f7967a7a
commit 152035aee7

View File

@ -188,4 +188,7 @@ class DjangoObjectPermissionsFilter(BaseFilterBackend):
'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)