Pergunta

{% if not User_Tld_Entered  %}
    #HTML HERE

{% endif %}

    {% if User_No_Auth_Tld > 0 %}
        {% for NotAuthDomain in User_No_Auth_Tld %}
            #HTML HERE
        {% endfor %}
    {% endif %}

{% else %}
    {% for tld in tld_set %}
        #HTML HERE
    {% endfor %}
{% endif %}

For some reason it is failing on the else condition above throwing:

Invalid block tag: 'else', expected 'endblock'

What am I doing wrong here?

Thank you.

Foi útil?

Solução

The first {% endif %} ends the first block. You then have if User_No_Auth_Tld > 0 and you close that block too. By the time {% else %} comes up, you're no longer within an if block so it's an unexpected tag.

If you remove the first {% endif %} it will work

Outras dicas

{% if not User_Tld_Entered  %}
    #HTML HERE

{% endif %} <- this one  needs to go  

    {% if User_No_Auth_Tld > 0 %}
        {% for NotAuthDomain in User_No_Auth_Tld %}
            #HTML HERE
        {% endfor %}
    {% endif %}   <- or this one nedds to go

{% else %} <-- whos else is this
    {% for tld in tld_set %}
        #HTML HERE
    {% endfor %}
{% endif %}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top