@register.simple_tag
def active(request, pattern):
    import re
    if re.search(pattern, request.path):
        return 'active'
    return ''
Simple tag let us define a regex for the active navigation tab
dataset/ETHPy150Open nyaruka/smartmin/smartmin/templatetags/smartmin.py/active