  from urllib import parse
  
  from django.core.paginator import InvalidPage
  from django.core.paginator import Paginator as DjangoPaginator
  from django.template import loader
  from django.utils.encoding import force_str
  from django.utils.translation import gettext_lazy as _
  
 
</s> remove             queryset = queryset.filter(**kwargs)
 </s> add             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) </s> remove                 has_item_with_unique_position = True
 </s> add                 has_item_with_unique_position = position is not None </s> remove                 has_item_with_unique_position = True
 </s> add                 has_item_with_unique_position = position is not None </s> remove                     if item.created < int(created__lt)
 </s> add                     if item.created is None or item.created < int(created__lt) </s> remove                         if item.created > int(created__gt)
 </s> add                         if item.created is None or item.created > int(created__gt)
from django.db.models import Q
  from urllib import parse
  
  from django.core.paginator import InvalidPage
  from django.core.paginator import Paginator as DjangoPaginator
from django.db.models import Q
  from django.template import loader
  from django.utils.encoding import force_str
  from django.utils.translation import gettext_lazy as _
  
keep keep keep add keep keep keep keep
 Ensure CursorPagination respects nulls in the ordering field (#8912)

* Ensure CursorPagination respects nulls in the ordering field

* Lint

* Fix pagination tests

* Add test_ascending with nulls

* Push tests for nulls

* Test pass

* Add comment

* Fix test for django30 
rest_framework/pagination.py