ali*_*s51 -3 python jinja2
我正在尝试创建一个条件if函数,如果列表的长度大于5,则显示结果:
if
{% if length(photos) > 5 %} ... {% endif %}
但是,我知道Could not parse the remainder: '(photos)' from 'length(photos)',我哪里错了?
Could not parse the remainder: '(photos)' from 'length(photos)'
谢谢
Ash*_*ary 8
正确的语法是:
{% if photos|length > 5 %} ... {% endif %}
归档时间:
11 年,3 月 前
查看次数:
4582 次
最近记录:
8 年,1 月 前