django模板解析 循环列表中 切片和求长度

{% for subrow in subdic.content|slice:":5" %}

{% endfor %}

{% if "{{subdic.content|length}}" > 5 %}

{% endif %}

如上,关键在于 循环中,里面的列表外面没有双引号

而if中,列表外面有双引号

网上很多文章太坑。。

原文地址:https://www.cnblogs.com/xqnq2007/p/7979551.html