registrasion/templatetags/registrasion_tags.py
def include_if_exists(parser, token):
    """Usage: {% include_if_exists "head.html" %}

    This will fail silently if the template doesn't exist. If it does, it will
    be rendered with the current context.

    From: https://djangosnippets.org/snippets/2058/
    """
    try:
        tag_name, template_name = token.split_contents()
    except ValueError:
        raise template.TemplateSyntaxError, \
            "%r tag requires a single argument" % token.contents.split()[0]

    return IncludeNode(template_name)
def include_if_exists(parser, token):
    """Usage: {% include_if_exists "head.html" %}

    This will fail silently if the template doesn't exist. If it does, it will
    be rendered with the current context.

    From: https://djangosnippets.org/snippets/2058/
    """
    try:
        tag_name, template_name = token.split_contents()
    except ValueError:
        raise template.TemplateSyntaxError, \
            "%r tag requires a single argument" % token.contents.split()[0]

    return IncludeNode(template_name)
Usage: {% include_if_exists "head.html" %}

    This will fail silently if the template doesn't exist. If it does, it will
    be rendered with the current context.

    From: https://djangosnippets.org/snippets/2058/