1
votes

Here's the error message populating my page, with the accompanying code issue:

TemplateSyntaxError at /home

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

Request Method: GET

Request URL: http://localhost:8000/home

Django Version: 1.3.1

Exception Type: TemplateSyntaxError

Exception Value: Invalid block tag: 'endblock', expected 'endif'

Code:

{% extends "profile/base_with_classes.html" %}

{% block username %}
    {% if user == None %}
        Nobody
        {% else %}
            {% if user.is_authenticated %}
            {{ user.username }}
        {% else %}
            Unauthenticated User
        {% endif %}
    (% endif %}
{% endblock username %}    <==== Issue is here

I don't understand. This is at the top of the template.

2

2 Answers

6
votes

In the last endif, you have ( instead of {

0
votes

Well, that is not only the problem; {% endblock %} tag does not really require the name of the block to close. Try to experiment with various cases when logged in and when not