Skip to content

Commit

Permalink
Apply querysets changes
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick91 committed Jun 14, 2024
1 parent 0131668 commit 9a87cd0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cursor_pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def _apply_paginator_arguments(self, qs, first=None, last=None, after=None, befo
if last is not None:
qs = qs.order_by(*self._nulls_ordering(reverse_ordering(self.ordering), from_last=True))[:last + 1]

return qs

def _get_cursor_page(self, items, has_additional, first, last, after, before):
"""
Create and return the cursor page for the given items
Expand All @@ -104,7 +106,7 @@ def _get_cursor_page(self, items, has_additional, first, last, after, before):

def page(self, first=None, last=None, after=None, before=None):
qs = self.queryset
self._apply_paginator_arguments(qs, first, last, after, before)
qs = self._apply_paginator_arguments(qs, first, last, after, before)

qs = list(qs)
page_size = first or last
Expand All @@ -117,7 +119,7 @@ def page(self, first=None, last=None, after=None, before=None):

async def apage(self, first=None, last=None, after=None, before=None):
qs = self.queryset
self._apply_paginator_arguments(qs, first, last, after, before)
qs = self._apply_paginator_arguments(qs, first, last, after, before)

page_size = first or last
items = []
Expand Down

0 comments on commit 9a87cd0

Please sign in to comment.