I'm trying to use something similar to this:
class User(DjangoObjectType):
class Meta:
model = auth_models.User
filter_fields = ('email', )
interfaces = (Node, )
connection = UserConnection
class UserConnection(Connection):
extra = graphene.String()
class Meta:
node = User
class Query(graphene.ObjectType):
users_connection = DjangoFilterConnectionField(
User,
where=UserWhereInput()
)
From my understanding, User node needs to be passed UserConnection on it's meta, and UserConnection needs to be passed User on it's meta.
However, it creates a cross reference. Any help?
And the answer can be found here:
https://github.com/graphql-python/graphene-django/issues/304
class UserConnection(Connection):
extra = graphene.String()
class Meta:
abstract = True
class User(DjangoObjectType):
class Meta:
model = auth_models.User
filter_fields = ('email', )
interfaces = (Node, )
connection_class = UserConnection
class Query(graphene.ObjectType):
users_connection = DjangoFilterConnectionField(User, where=UserWhereInput())