Skip to content

Update authorization.rst #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/authorization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down