[Answered ]-Self-referencing class variable in Python

2👍

Based on https://github.com/graphql-python/graphene/issues/110, the correct way to do this is with a string:

class FolderNode(DjangoObjectType):
    folders = graphene.List('FolderNode')

0👍

An idea: what about defining a property not considered at class creation, as follows

class FolderNode(DjangoObjectType):
    @property
    def folders(self):
        return graphene.List(FolderNode)

Leave a comment