Test pass

This commit is contained in:
ddelange 2023-03-24 10:32:02 +01:00
parent b089edcd06
commit 0dd0873b41
No known key found for this signature in database
GPG Key ID: AFC17B7BBC0301A6
2 changed files with 3 additions and 3 deletions

View File

@ -632,9 +632,9 @@ class CursorPagination(BasePagination):
else:
kwargs = {order_attr + '__gt': current_position}
# If some records contain a null for the ordering field, don't lose them.
filter_query = Q(**kwargs)
if reverse:
# If some records contain a null for the ordering field, don't lose them.
if (reverse and not is_reversed) or is_reversed:
filter_query |= Q(**{order_attr + '__isnull': True})
queryset = queryset.filter(filter_query)

View File

@ -1154,7 +1154,7 @@ class TestCursorPaginationWithNulls(TestCase):
assert current == [None]
assert next == [None]
def test_decending(self):
def test_descending(self):
"""Test paginating one row at a time, current should go 4, 3, 2, 1, 2, 3, 4."""
self.pagination.ordering = ('-created',)
(previous, current, next, previous_url, next_url) = self.get_pages('/')