Skip to content

Instantly share code, notes, and snippets.

from django import template
from django.core.urlresolvers import reverse
def do_if_active_url(parser, token):
tag_name, request, urls = token.split_contents()
except ValueError:
raise template.TemplateSyntaxError, ("%r tag requires exactly two arguments, received" %
token.contents.split()[0], len(token.contents.split()[0]))
if not (urls[0] == urls[-1] and urls[0] in ('"', "'")):
You can’t perform that action at this time.