'Add items from the \'ordering\' sequence to the query\'s "order by"
clause. These items are either field names (not column names) --
possibly with a direction prefix (\'-\' or \'?\') -- or OrderBy
expressions.
If \'ordering\' is empty, clear all ordering from the query.'

def add_ordering(self, *ordering):

    errors = []
    for item in ordering:
        if ((not hasattr(item, 'resolve_expression')) and (not ORDER_PATTERN.match(item))):
            errors.append(item)
        if getattr(item, 'contains_aggregate', False):
            raise FieldError(('Using    an    aggregate    in    order_by()    without    also    including    it    in    annotate()    is    not    allowed:    %s' % item))
    if errors:
        raise FieldError(('Invalid    order_by    arguments:    %s' % errors))
    if ordering:
        self.order_by += ordering
    else:
        self.default_ordering = False
