Closed
Description
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
?
Metadata
Metadata
Assignees
Labels
No labels