diff --git a/docs/authorization.rst b/docs/authorization.rst index 0ddbf36..a291930 100644 --- a/docs/authorization.rst +++ b/docs/authorization.rst @@ -229,3 +229,16 @@ We can set multiple required permissions like this: pet_name = input.get('name') pet = Pet.objects.create(name=pet_name) return CreatePet(pet=pet) + +Adding permissions to filters +----------------------------- +We use DjangoFilterConnectionField to create filters to our nodes. Graphene-django has a field with +permission required ``AuthDjangoFilterConnectionField``. This field requires permissions to access +to it's nodes and is simple to create your filters. + +.. code:: python + + class MyCustomFilter(AuthDjangoFilterConnectionField): + _permission = ('app.add_pet', 'app.delete_pet') + +With this example code we can implement filters with required permissions. diff --git a/setup.py b/setup.py index 38a16c5..940d949 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ tests_require = [ 'coveralls', 'mock', 'pytz', - 'django-filter', + 'django-filter==0.9.2', 'pytest-django==2.9.1', ]