@register.function
@jinja2.contextfunction
def sort_link(context, pretty_name, sort_field):
 request = context['request']
 (sort, order) = clean_sort_param(request)
 get_params = [(k, v) for (k, v) in urlparse.parse_qsl(smart_str(request.META['QUERY_STRING'])) if (k not in ('sort', 'order'))]
 return create_sort_link(pretty_name, sort_field, get_params, sort, order)

@ register . function @ jinja2 . contextfunction def sort_link ( context , pretty_name , sort_field ) : request = context [ 'request' ] ( sort , order ) = clean_sort_param ( request ) get_params = [ ( k , v ) for ( k , v ) in urlparse . parse_qsl ( smart_str ( request . META [ 'QUERY_STRING' ] ) ) if ( k not in ( 'sort' , 'order' ) ) ] return create_sort_link ( pretty_name , sort_field , get_params , sort , order )
get table header sort links .