@library.filter
def urlparams(url_, hash=None, **query):
    url = urlparse.urlparse(url_)
    fragment = hash if hash is not None else url.fragment

    # Use dict(parse_qsl) so we don't get lists of values.
    query_dict = dict(urlparse.parse_qsl(url.query))
    query_dict.update(query)

    query_string = urlencode(
        [(k, v) for k, v in query_dict.items() if v is not None])
    new = urlparse.ParseResult(url.scheme, url.netloc, url.path, url.params,
                               query_string, fragment)
    return new.geturl()
Add a fragment and/or query paramaters to a URL.
dataset/ETHPy150Open mozilla/sugardough/{{ cookiecutter.project_name }}/{{ cookiecutter.project_name }}/base/templatetags/helpers.py/urlparams