1 2 3 4 5 6 7 8 9 10 11 12 13 | from django.template import Variable, VariableDoesNotExist
QUOTED_STRING = re.compile(r'^["\'](?P<noquotes>.+)["\']$')
def handle_var(self, value, context):
stringval = QUOTED_STRING.search(value)
if stringval:
return stringval.group('noquotes')
else:
try:
return Variable(value).resolve(context)
except VariableDoesNotExist:
return value
|
More like this
- Dynamic Regroup Template Tag by btaylordesign 1 year, 9 months ago
- a simple tag with context by dsblank 3 years, 4 months ago
- Manipulate URL query strings using context variables using a template tag by JHsaunders 2 years, 7 months ago
- A GET string modifier templatetag by cogat 4 years, 5 months ago
- Call a manager method on any model with a filter by coleifer 3 years ago
Comments