mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-10 19:57:15 +03:00
Update authorization.rst
Upgrading doc, as suggested in https://github.com/graphql-python/graphene-django/issues/282
This commit is contained in:
parent
f35e445963
commit
9c9cef4ea9
|
@ -81,12 +81,12 @@ with the context argument.
|
|||
class Query(ObjectType):
|
||||
my_posts = DjangoFilterConnectionField(CategoryNode)
|
||||
|
||||
def resolve_my_posts(self, args, context, info):
|
||||
def resolve_my_posts(self, info):
|
||||
# context will reference to the Django request
|
||||
if not context.user.is_authenticated():
|
||||
if not info.context.user.is_authenticated():
|
||||
return Post.objects.none()
|
||||
else:
|
||||
return Post.objects.filter(owner=context.user)
|
||||
return Post.objects.filter(owner=info.context.user)
|
||||
|
||||
If you're using your own view, passing the request context into the
|
||||
schema is simple.
|
||||
|
|
Loading…
Reference in New Issue
Block a user