Skip to content

Commit

Permalink
Pass guardian shortcut kwargs with class attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
rpkilby committed Nov 3, 2018
1 parent 2d346b1 commit b1cba0d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/rest_framework_guardian/filters.py
Expand Up @@ -8,6 +8,9 @@ class DjangoObjectPermissionsFilter(BaseFilterBackend):
has read object level permissions.
"""
perm_format = '%(app_label)s.view_%(model_name)s'
shortcut_kwargs = {
'accept_global_perms': False,
}

def __init__(self):
assert 'guardian' in settings.INSTALLED_APPS, (
Expand All @@ -28,5 +31,4 @@ def filter_queryset(self, request, queryset, view):

return get_objects_for_user(
user, permission, queryset,
accept_global_perms=False,
)
**self.shortcut_kwargs)

0 comments on commit b1cba0d

Please sign in to comment.