#NEWLINE# def add_ordering( self , * ordering ) : #NEWLINE# #INDENT# '\n        Adds items from the \'ordering\' sequence to the query\'s "order by"\n        clause. These items are either field names (not column names) --\n        possibly with a direction prefix (\'-\' or \'?\') -- or ordinals,\n        corresponding to column positions in the \'select\' list.\n\n        If \'ordering\' is empty, all ordering is cleared from the query.\n        ' #NEWLINE# errors = [ ] #NEWLINE# for item in ordering : #NEWLINE# #INDENT# if ( not ORDER_PATTERN . match ( item ) ) : #NEWLINE# #INDENT# errors . append ( item ) #NEWLINE# #UNINDENT# #UNINDENT# if errors : #NEWLINE# #INDENT# raise FieldError ( ( 'Invalid order_by arguments: %s' % errors ) ) #NEWLINE# #UNINDENT# if ordering : #NEWLINE# #INDENT# self . order_by . extend ( ordering ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . default_ordering = False