Should I be adding description to meta class of DjangoObjectType?
Update:
Adding description to meta class of DjangoObjectType did not do anything.
Can you provide a code snippet?
Here is a working example of mine :
class ChannelNode(DjangoObjectType):
class Meta:
model = Channel
filter_fields = {'name': ['exact', 'icontains', 'istartswith'],
'customer': ['exact', 'icontains', 'istartswith']}
interfaces = (relay.Node,)
description = "This is a Channel Node"
If you navigate on ChannelNode on the GraphiQl you will see the description.
Awesome that's what I wanted to know. Thanks for the help.
What about description for model fields?
How can I attach description for the fields of ChannelNode (name, customer etc...)?
@itaied246 Might want to open a new request
@itaied246
What about description for model fields?
How can I attach description for the fields of ChannelNode (name, customer etc...)?
just pass a parameter like this
DjangoFilterConnectionField(PageNode, description='test')
or still you can create meta class:
class MenuNode(DjangoObjectType):
class Meta:
model = MenuModel
interfaces = (graphene.relay.Node, )
description = 'menu node'
in additional to all above you can rename your fields just create in class Meta var name='bla_bla'
only restriction no spaces and other special symbols. You can use this pattern to ensure:
Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/
So i just tried this with no luck. Am I doing somthing wrong or has something changed?
from graphene_django import DjangoObjectType
from .models import Question as QuestionModel
import graphene
class Question(DjangoObjectType):
class Meta:
model = QuestionModel
description = "This is a Question"
Most helpful comment
What about description for model fields?
How can I attach description for the fields of
ChannelNode(name,customeretc...)?