from django import template

register = template.Library()

@register.simple_tag
def query_string(request, **kwargs):
    query_dict = request.GET.copy()
    for key, value in kwargs.items():
        query_dict[key] = value
    return query_dict.urlencode()
