Upgrade guardian support to 1.3. Closes #3163.

This commit is contained in:
Tom Christie 2015-07-16 16:46:07 +01:00
parent 7b21336872
commit 788aae2aaf
2 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# Optional packages which may be used with REST framework. # Optional packages which may be used with REST framework.
markdown==2.5.2 markdown==2.5.2
django-guardian==1.2.5 django-guardian==1.3.0
django-filter==0.10.0 django-filter==0.10.0

View File

@ -198,4 +198,7 @@ class DjangoObjectPermissionsFilter(BaseFilterBackend):
'model_name': get_model_name(model_cls) 'model_name': get_model_name(model_cls)
} }
permission = self.perm_format % kwargs 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)