From e844cb36df8a815efb2875b5ebc05cbd14684933 Mon Sep 17 00:00:00 2001 From: Anthony Monthe Date: Wed, 31 Oct 2018 16:39:59 +0000 Subject: [PATCH] Improved pagination --- graphene_django_extras/paginations/pagination.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/graphene_django_extras/paginations/pagination.py b/graphene_django_extras/paginations/pagination.py index 496c142..fd93460 100644 --- a/graphene_django_extras/paginations/pagination.py +++ b/graphene_django_extras/paginations/pagination.py @@ -77,7 +77,6 @@ def to_graphql_fields(self): } def paginate_queryset(self, qs, **kwargs): - count = _get_count(qs) limit = _nonzero_int( kwargs.get(self.limit_query_param, None), strict=True, @@ -96,13 +95,7 @@ def paginate_queryset(self, qs, **kwargs): else: qs = qs.order_by(order) - if limit < 0: - offset = kwargs.get(self.offset_query_param, count) + limit - else: - offset = kwargs.get(self.offset_query_param, 0) - - if count == 0 or offset > count or offset < 0: - return [] + offset = kwargs.get(self.offset_query_param, 0) return qs[offset:offset + fabs(limit)]