You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With Connection, one can implement a count on edges like so:
from graphene import Connection, ConnectionField, Node, Int
from graphene_django import DjangoObjectType
from ..models import Place
class Thing_Type(DjangoObjectType):
class Meta:
model = Thing
interfaces = (Node, )
class Thing_Connection(Connection):
class Meta:
node = Thing_Type
count = Int()
def resolve_count(root, info):
return len(root.edges)
class Query(object):
things = ConnectionField(Thing_Connection)
def resolve_things(root, info, **kwargs):
return Thing.objects.all()
return len(root.edges)
Given that DjangoFilterConnectionField won't accept a Connection, but requires a DjangoObjectType, how would one implement an equivalent count?