Use field and exclude in docs instead deprecated attrs (#740)

This commit is contained in:
Semyon Pupkov 2019-09-07 21:49:41 +05:00 committed by Mel van Londen
parent 1b8184ece1
commit ac79b38cf0

View File

@ -20,7 +20,7 @@ Let's use a simple example model.
Limiting Field Access Limiting Field Access
--------------------- ---------------------
To limit fields in a GraphQL query simply use the ``only_fields`` meta attribute. To limit fields in a GraphQL query simply use the ``fields`` meta attribute.
.. code:: python .. code:: python
@ -31,10 +31,10 @@ To limit fields in a GraphQL query simply use the ``only_fields`` meta attribute
class PostNode(DjangoObjectType): class PostNode(DjangoObjectType):
class Meta: class Meta:
model = Post model = Post
only_fields = ('title', 'content') fields = ('title', 'content')
interfaces = (relay.Node, ) interfaces = (relay.Node, )
conversely you can use ``exclude_fields`` meta attribute. conversely you can use ``exclude`` meta attribute.
.. code:: python .. code:: python
@ -45,7 +45,7 @@ conversely you can use ``exclude_fields`` meta attribute.
class PostNode(DjangoObjectType): class PostNode(DjangoObjectType):
class Meta: class Meta:
model = Post model = Post
exclude_fields = ('published', 'owner') exclude = ('published', 'owner')
interfaces = (relay.Node, ) interfaces = (relay.Node, )
Queryset Filtering On Lists Queryset Filtering On Lists
@ -133,7 +133,7 @@ method to your ``DjangoObjectType``.
class PostNode(DjangoObjectType): class PostNode(DjangoObjectType):
class Meta: class Meta:
model = Post model = Post
only_fields = ('title', 'content') fields = ('title', 'content')
interfaces = (relay.Node, ) interfaces = (relay.Node, )
@classmethod @classmethod