#NEWLINE# def order_queryset( queryset , by , direction ) : #NEWLINE# #INDENT# if ( by == 'dsc' ) : #NEWLINE# #INDENT# order_str = ( '-%s' % by ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# order_str = by #NEWLINE# #UNINDENT# return queryset . order_by ( order_str )