Add comment

This commit is contained in:
ddelange 2023-03-24 10:49:30 +01:00
parent 0dd0873b41
commit c535420525
No known key found for this signature in database
GPG Key ID: AFC17B7BBC0301A6

View File

@ -634,6 +634,7 @@ class CursorPagination(BasePagination):
filter_query = Q(**kwargs)
# If some records contain a null for the ordering field, don't lose them.
# When reverse ordering, nulls will come last and need to be included.
if (reverse and not is_reversed) or is_reversed:
filter_query |= Q(**{order_attr + '__isnull': True})
queryset = queryset.filter(filter_query)