This commit is contained in:
Vlad Dragos 2017-05-22 20:25:19 +00:00 committed by GitHub
commit a4c34a85bf

View File

@ -503,10 +503,11 @@ class CursorPagination(BasePagination):
(offset, reverse, current_position) = self.cursor (offset, reverse, current_position) = self.cursor
# Cursor pagination always enforces an ordering. # Cursor pagination always enforces an ordering.
if reverse: if not queryset.ordered:
queryset = queryset.order_by(*_reverse_ordering(self.ordering)) if reverse:
else: queryset = queryset.order_by(*_reverse_ordering(self.ordering))
queryset = queryset.order_by(*self.ordering) else:
queryset = queryset.order_by(*self.ordering)
# If we have a cursor with a fixed position then filter by that. # If we have a cursor with a fixed position then filter by that.
if current_position is not None: if current_position is not None: