1👍
✅
Use graphene_django.DjangoListField
:
from graphene_django import DjangoListField, DjangoObjectType
class CategoryType(DjangoObjectType):
grocery = DjangoListField(GroceryType)
Alternatively, implement a resolver:
import graphene
from graphene_django import DjangoObjectType
class CategoryType(DjangoObjectType):
grocery = graphene.List(GroceryType)
@staticmethod
def resolve_grocery(parent, info):
return parent.grocery.all()
Source:stackexchange.com