Skip to content

Instantly share code, notes, and snippets.

@benbacardi
benbacardi / templatetags.py
Last active October 11, 2023 11:03
Django query_transform templatetag
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def query_transform(context, **kwargs):
'''
Returns the URL-encoded querystring for the current page,
updating the params with the key/value pairs passed to the tag.