@register.simple_tag
def nav_active(request, pattern):
 if (pattern in request.path):
  return u'nav-active'
 return u''

@ register . simple_tag def nav_active ( request , pattern ) : if ( pattern in request . path ) : return u'nav-active' return u''
helper to render a class name for active navigation items .