From c535420525eacead922815eb080b745c28543e8d Mon Sep 17 00:00:00 2001 From: ddelange <14880945+ddelange@users.noreply.github.com> Date: Fri, 24 Mar 2023 10:49:30 +0100 Subject: [PATCH] Add comment --- rest_framework/pagination.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rest_framework/pagination.py b/rest_framework/pagination.py index 50af70493..34d71f828 100644 --- a/rest_framework/pagination.py +++ b/rest_framework/pagination.py @@ -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)