mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-02-12 09:30:35 +03:00
Use field and exclude in docs instead deprecated attrs (#740)
This commit is contained in:
parent
1b8184ece1
commit
ac79b38cf0
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user