#NEWLINE# @ app_template_filter ( 'link_order' ) #NEWLINE# def link_order_filter( self , column , modelview_name ) : #NEWLINE# #INDENT# "\n            Arguments are passed like: _oc_<VIEW_NAME>=<COL_NAME>&_od_<VIEW_NAME>='asc'|'desc'\n        " #NEWLINE# new_args = request . view_args . copy ( ) #NEWLINE# args = request . args . copy ( ) #NEWLINE# if ( ( '_oc_' + modelview_name ) in args ) : #NEWLINE# #INDENT# args [ ( '_oc_' + modelview_name ) ] = column #NEWLINE# if ( args . get ( ( '_od_' + modelview_name ) ) == 'asc' ) : #NEWLINE# #INDENT# args [ ( '_od_' + modelview_name ) ] = 'desc' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# args [ ( '_od_' + modelview_name ) ] = 'asc' #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# args [ ( '_oc_' + modelview_name ) ] = column #NEWLINE# args [ ( '_od_' + modelview_name ) ] = 'asc' #NEWLINE# #UNINDENT# return url_for ( request . endpoint , ** dict ( ( list ( new_args . items ( ) ) + list ( args . to_dict ( ) . items ( ) ) ) ) )