mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-02-22 06:20:33 +03:00
Update test depencies
This commit is contained in:
parent
4058c2a76a
commit
989fcfeed8
|
@ -229,3 +229,16 @@ We can set multiple required permissions like this:
|
||||||
pet_name = input.get('name')
|
pet_name = input.get('name')
|
||||||
pet = Pet.objects.create(name=pet_name)
|
pet = Pet.objects.create(name=pet_name)
|
||||||
return CreatePet(pet=pet)
|
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.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user