我正在尝试确定我发送的列表是否为空..但是我收到此错误
我的代码:
{% if {{all_puzzles|length}} = 0 %}
<h4 style="text-align: center">No puzzles found :/<br>
<a href="/create/" type="button" class="btn btn-default pull-right">Create a Puzzle</a></h4><br>
{% endif %}
错误:
Template error:
In template /Users/Jyby/Documents/gpsp/templates/mypuzzles.html, error at line 26
Could not parse some characters: |{{all_puzzles||length}}
答案 0 :(得分:1)
尝试:
{% if all_puzzles|length = 0 %}
或者您也可以这样做:
{% if not all_puzzles|length %}
会影响相同的条件。