@@ -34,7 +34,7 @@ This is easy, simply use the ``only_fields`` meta attribute.
34
34
only_fields = (' title' , ' content' )
35
35
interfaces = (relay.Node, )
36
36
37
- conversely you can use ``exclude_fields `` meta atrribute .
37
+ conversely you can use ``exclude_fields `` meta attribute .
38
38
39
39
.. code :: python
40
40
@@ -61,7 +61,7 @@ define a resolve method for that field and return the desired queryset.
61
61
from .models import Post
62
62
63
63
class Query (ObjectType ):
64
- all_posts = DjangoFilterConnectionField(CategoryNode )
64
+ all_posts = DjangoFilterConnectionField(PostNode )
65
65
66
66
def resolve_all_posts (self , args , info ):
67
67
return Post.objects.filter(published = True )
@@ -79,14 +79,14 @@ with the context argument.
79
79
from .models import Post
80
80
81
81
class Query (ObjectType ):
82
- my_posts = DjangoFilterConnectionField(CategoryNode )
82
+ my_posts = DjangoFilterConnectionField(PostNode )
83
83
84
- def resolve_my_posts (self , args , context , info ):
84
+ def resolve_my_posts (self , info ):
85
85
# context will reference to the Django request
86
- if not context.user.is_authenticated():
86
+ if not info. context.user.is_authenticated():
87
87
return Post.objects.none()
88
88
else :
89
- return Post.objects.filter(owner = context.user)
89
+ return Post.objects.filter(owner = info. context.user)
90
90
91
91
If you're using your own view, passing the request context into the
92
92
schema is simple.
0 commit comments