小编tat*_*ata的帖子

Django模板问题 - {%if object | length> 4%}引发TemplateDoesNotExist:500.html

我的模板中有以下内容.

{% 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 %}
Run Code Online (Sandbox Code Playgroud)

它引发了TemplateDoesNotExist:500.html.

如果我写{{ fotoList|length }}得很简单就行了.

comparison filter django-templates

9
推荐指数
4
解决办法
2万
查看次数

标签 统计

comparison ×1

django-templates ×1

filter ×1