mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-02 20:54:16 +03:00
Fixed resolver in Django
This commit is contained in:
parent
12ffb027fa
commit
4cadf33b4f
|
@ -23,8 +23,9 @@ class DjangoConnectionField(ConnectionField):
|
||||||
def default_resolver(self, root, args, context, info):
|
def default_resolver(self, root, args, context, info):
|
||||||
return getattr(root, self.source or self.attname, self.get_manager())
|
return getattr(root, self.source or self.attname, self.get_manager())
|
||||||
|
|
||||||
def connection_resolver(self, root, args, context, info):
|
@staticmethod
|
||||||
iterable = super(ConnectionField, self).resolver(root, args, context, info)
|
def connection_resolver(resolver, connection, root, args, context, info):
|
||||||
|
iterable = resolver(root, args, context, info)
|
||||||
iterable = maybe_queryset(iterable)
|
iterable = maybe_queryset(iterable)
|
||||||
if isinstance(iterable, QuerySet):
|
if isinstance(iterable, QuerySet):
|
||||||
_len = iterable.count()
|
_len = iterable.count()
|
||||||
|
@ -36,8 +37,8 @@ class DjangoConnectionField(ConnectionField):
|
||||||
slice_start=0,
|
slice_start=0,
|
||||||
list_length=_len,
|
list_length=_len,
|
||||||
list_slice_length=_len,
|
list_slice_length=_len,
|
||||||
connection_type=self.connection,
|
connection_type=connection,
|
||||||
edge_type=self.connection.Edge,
|
edge_type=connection.Edge,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user