views:

476

answers:

2

Hello, I have the following in my template.

{% block content %}
    {% for album in albumsList %}
        {% if fotosList %}
            <div class="photoalbum-wrapper">
                <h3>{{ album.title }}</h3>
                <ul class="photoalbum">
                    {% for foto in fotosList %}<li>item</li>{% endfor %}
                </ul>
                {% if fotosList|length > 4 %}
                    <a href="#" class="trigger">больше <span>&#9660;</span></a>
                {% endif %}
            </div>
        {% endif %}  
    {% endfor %}
{% endblock %}

And it raises TemplateDoesNotExist: 500.html.

If i write simple {{ fotoList|length }} it works okay.

A: 

{% if fotosList|length > 4 %} is not a valid tag; you can't use greater than/less than operators in the Django if tag. (You can use operators in the latest development release, but I'm assuming you're not using the latest version from Django's SVN repository.)

The reason you get the TemplateDoesNotExist error is because Django is throwing a 500 Internal Server Error (due to the invalid tag), but you haven't supplied a 500.html error template, as noted here.

mipadi
A: 

FYI if tags with the operators ==, !=, <, >, <=, >= are supported now in the development version of Django.

spyder