We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b4be0d1 commit dd46f5fCopy full SHA for dd46f5f
docs/authorization.rst
@@ -96,6 +96,29 @@ schema is simple.
96
97
result = schema.execute(query, context_value=request)
98
99
+
100
+Global Filtering
101
+----------------
102
103
+If you are using ``DjangoObjectType`` you can define a custom `get_queryset`.
104
105
+.. code:: python
106
107
+ from graphene import relay
108
+ from graphene_django.types import DjangoObjectType
109
+ from .models import Post
110
111
+ class PostNode(DjangoObjectType):
112
+ class Meta:
113
+ model = Post
114
115
+ @classmethod
116
+ def get_queryset(cls, queryset, info):
117
+ if info.context.user.is_anonymous:
118
+ return queryset.filter(published=True)
119
+ return queryset
120
121
122
Filtering ID-based Node Access
123
------------------------------
124
0 commit comments