code: def remove_invalid_fields(self, queryset, fields, view):
          valid_orderings = []
          invalid_orderings = []
          for term in fields:
              stripped_term = term.lstrip('-')
              reverse_sort_term = '' if len(stripped_term) is len(term) else '-'
              ordering = self.ordering_for(stripped_term, view)
              if ordering:
                  valid_orderings.append(reverse_sort_term + ordering)
              else:
                  invalid_orderings.append(term)
          return valid_orderings, invalid_orderings