Django: Invalid block tag on line 14: 'else'. Did you forget to register or load this tag?

13,033

The problem is with your if tag.

Replace:

 % if latest_questions %)

with:

 {% if latest_questions %}
Share:
13,033
Ula
Author by

Ula

Updated on June 14, 2022

Comments

  • Ula
    Ula almost 2 years

    During Django tutorial I've got an issue with index.html file. I can't handle this exception:

    Invalid block tag on line 14: 'else'. Did you forget to register or load this tag?

    My index.html is like this:

        {% if latest_questions %)
        <ul>
            {% for question in latest_questions %}
                 <li> <a href="/polls/{{question.id}}"><b>{{question.question_text}}</b></a></li>
            {% endfor %}
        </ul>
    {% else %}
        Something else.
    {% endif %}
    

    I really don't understand why it don't recognize "else".