code: def set_sort(self, request):
          sort_request = request.GET.get(self.sort_parameter, self.default_sort)
          if sort_request.startswith('-'):
              sort_order = '-'
              sort_field = sort_request.split('-')[1]
          else:
              sort_order = ''
              sort_field = sort_request
          if not sort_field in self._allowed_sort_fields:
              sort_order = self.default_sort_order
              sort_field = self.default_sort_field
          return (sort_order, sort_field)