          if isinstance(instance, dict):
              attr = instance[field_name]
          else:
              attr = getattr(instance, field_name)
          return str(attr)
  
      def get_paginated_response(self, data):
          return Response(OrderedDict([
              ('next', self.get_next_link()),
              ('previous', self.get_previous_link()),
 
</s> remove             def filter(self, created__gt=None, created__lt=None):
 </s> add             def filter(self, q):
                q_args = dict(q.deconstruct()[1])
                if not q_args:
                    # django 3.0.x artifact
                    q_args = dict(q.deconstruct()[2])
                created__gt = q_args.get('created__gt')
                created__lt = q_args.get('created__lt')
 </s> remove         if current_position is not None:
 </s> add         if str(current_position) != 'None': </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                     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)
        return None if attr is None else str(attr)
          if isinstance(instance, dict):
              attr = instance[field_name]
          else:
              attr = getattr(instance, field_name)
        return None if attr is None else str(attr)
  
      def get_paginated_response(self, data):
          return Response(OrderedDict([
              ('next', self.get_next_link()),
              ('previous', self.get_previous_link()),
keep keep keep keep replace keep 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