Search code examples
pythondjangoerror-handlingnavigationpinax

How to add a link to the navigation pinax(0.9a2)?


I want to add new links to the standart bootstap theme in pinax. I tried to implement the in my site:

{% block nav %}
    {% if user.is_authenticated %}
        <ul>{% spaceless %}
            <li id="tab_profile"><a href="{% url profile_detail user.username %}">{% trans "Profile" %}</a></li>
            <li id="tab_notices"><a href="{% url notification_notices %}">{% trans "Notices" %}{% if notice_unseen_count %} ({{ notice_unseen_count }}){% endif %}</a></li>
        {% endspaceless %
            <li id="tab_first">
                <a href="#">First Link</a>
            </li>
        }</ul>
    {% endif %}
{% endblock %}

but I get an error:

TemplateSyntaxError at /

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

Therefore, how to add a new link to the navbar?


Solution

  • You got a syntax error, you didn't terminate endspaceless correctly:

    {% endspaceless %
        <li id="tab_first">
            <a href="#">First Link</a>
        </li>
    }</ul>
    

    should be:

    {% endspaceless %}
        <li id="tab_first">
            <a href="#">First Link</a>
        </li>
    </ul>