#NEWLINE# @ register . simple_tag ( takes_context = True ) #NEWLINE# def to_query_params( context , request = None , **params ) : #NEWLINE# #INDENT# '\n    Adds params to current query string\n    ' #NEWLINE# request = ( request or context [ 'request' ] ) #NEWLINE# query_dict = request . GET . copy ( ) #NEWLINE# for ( k , v ) in sorted ( params . items ( ) ) : #NEWLINE# #INDENT# query_dict [ k ] = v #NEWLINE# #UNINDENT# return query_dict . urlencode ( )