@register.filter<EOL>def template_exists(template_name):
try:<EOL><INDENT>template.loader.get_template(template_name)<EOL>return True<EOL><DEDENT>except template.TemplateDoesNotExist:<EOL><INDENT>return False<EOL><DEDENT>
Determine if a given template exists so that it can be loaded
if so, or a default alternative can be used if not.