Jahmul14
Jahmul14

Reputation: 349

django templates Unclosed tag on line 10: 'if'. Looking for one of: endif

I am getting the following error message in my django template: Unclosed tag on line 10: 'if'. Looking for one of: endif.

I use endif on line 20 to close the if category. if pages is closed on line 16. Not sure if it is a syntax issue?

<!DOCTYPE html>
<html>

<head>
<title>Rango</title>
</head>

<body>
    <div>
    {% if category %}
            {{ category.name }}
    <ul>
    {% if pages %}
        {% for page in pages %}
        <li>    {{ page.title }} </li>
        {% endfor %}
    </ul>
    {% else %}
        <strong>No Pages</strong>
    {% endif %}

    {% else %}
            <strong>The specified category does not exist!</strong>
    <% endif %}
    </div>
</body>

Upvotes: 3

Views: 5239

Answers (2)

Shahriar Hossain
Shahriar Hossain

Reputation: 148

In the last endif, you have ( instead of {

<% endif %}

to

{% endif %}

Upvotes: 2

mindcruzer
mindcruzer

Reputation: 844

The last endif: <% endif %}

Upvotes: 6

Related Questions