mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 01:26:53 +03:00
Upgrade guardian support to 1.3. Closes #3163.
This commit is contained in:
parent
7b21336872
commit
788aae2aaf
|
@ -1,4 +1,4 @@
|
|||
# Optional packages which may be used with REST framework.
|
||||
markdown==2.5.2
|
||||
django-guardian==1.2.5
|
||||
django-guardian==1.3.0
|
||||
django-filter==0.10.0
|
||||
|
|
|
@ -198,4 +198,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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user