Skip to content

Instantly share code, notes, and snippets.

@benbacardi
benbacardi / templatetags.py
Last active September 1, 2025 00:54
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.