Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion graphene_django/fields.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from functools import partial

from django.db.models.query import QuerySet
from django.db.models import Count
from graphql_relay.connection.arrayconnection import (
connection_from_array_slice,
cursor_to_offset,
Expand Down Expand Up @@ -144,7 +145,7 @@ def resolve_connection(cls, connection, args, iterable, max_limit=None):
iterable = maybe_queryset(iterable)

if isinstance(iterable, QuerySet):
list_length = iterable.count()
list_length = iterable.aggregate(Count('pk'))['pk__count']
else:
list_length = len(iterable)
list_slice_length = (
Expand Down