#NEWLINE# def order_by( self , * field_names ) : #NEWLINE# #INDENT# for field in field_names : #NEWLINE# #INDENT# if ( field == 'pk' ) : #NEWLINE# #INDENT# field = desc . model . _meta . pk . name #NEWLINE# #UNINDENT# desc = False #NEWLINE# if ( field [ 0 ] == '-' ) : #NEWLINE# #INDENT# field = field [ 1 : ] #NEWLINE# desc = True #NEWLINE# #UNINDENT# method_name = '{0}__{1}' . format ( 'order' , field ) #NEWLINE# default_method_name = '{0}__' . format ( 'order' ) #NEWLINE# method = getattr ( self , default_method_name ) #NEWLINE# if hasattr ( self , method_name ) : #NEWLINE# #INDENT# method = getattr ( self , method_name ) #NEWLINE# #UNINDENT# method ( field , desc ) #NEWLINE# #UNINDENT# return self