Skip to content

Commit

Permalink
Improved pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
ZuluPro committed Oct 31, 2018
1 parent 1c95c88 commit e844cb3
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions graphene_django_extras/paginations/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)]

Expand Down

0 comments on commit e844cb3

Please sign in to comment.