graphql-python / graphene

GraphQL framework for Python

Home Page:http://graphene-python.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

set field name explicitly

tasiotas opened this issue · comments

Hi,

How can I set field name explicitly? By default field name is derived from class name. Can I override it?
In ObjectType source I can see comment that its possible, but I cannot get it working.

I have

class MediaItemType(DjangoObjectType):
    class Meta:
        model = UserMediaItem
        name = "MediaItem"   # <--- that doesnt work

Would like to have field called mediaitemSet not usermediaitemSet. Btw. this Model is a ForeignKey, hence 'Set' at the end.

From types/objecttype.py

    Meta class options (optional):
        name (str): Name of the GraphQL type (must be unique in schema). Defaults to class
            name.

sorry, I posted it in wrong repo, its about graphene-django