              # View explicitly allows filtering on any model field
              valid_fields = [field.name for field in queryset.model._meta.fields]
              valid_fields += queryset.query.aggregates.keys()
  
          return [term for term in ordering if term.lstrip('-') in valid_fields]
  
      def filter_queryset(self, request, queryset, view):
          ordering = self.get_ordering(request)
  
          if ordering:
 
</s> remove         ordering = self.get_ordering(request)

        if ordering:
            # Skip any incorrect parameters
            ordering = self.remove_invalid_fields(queryset, ordering, view)

        if not ordering:
            # Use 'ordering' attribute by default
            ordering = self.get_default_ordering(view)
 </s> add         ordering = self.get_ordering(request, queryset, view) </s> remove     def remove_invalid_fields(self, queryset, ordering, view):
 </s> add     def remove_invalid_fields(self, queryset, fields, view): </s> remove             return [param.strip() for param in params.split(',')]
 </s> add             fields = [param.strip() for param in params.split(',')]
            ordering = self.remove_invalid_fields(queryset, fields, view)
            if ordering:
                return ordering

        # No ordering was included, or all the ordering fields were invalid
        return self.get_default_ordering(view) </s> remove         self.ordering = self.get_ordering(view)
 </s> add         self.ordering = self.get_ordering(request, queryset, view) </s> remove     def get_ordering(self, request):
 </s> add     def get_ordering(self, request, queryset, view):
        return [term for term in fields if term.lstrip('-') in valid_fields]
              # View explicitly allows filtering on any model field
              valid_fields = [field.name for field in queryset.model._meta.fields]
              valid_fields += queryset.query.aggregates.keys()
  
        return [term for term in fields if term.lstrip('-') in valid_fields]
  
      def filter_queryset(self, request, queryset, view):
          ordering = self.get_ordering(request)
  
          if ordering:
keep keep keep keep replace keep keep keep keep keep
 Cursor pagination now works with OrderingFilter 
rest_framework/filters.py