cro*_*jer 0 python google-app-engine loops django-templates conditional-statements
我正在尝试使用app引擎模板和html表生成一个板(10X10).所以这意味着在循环的10次迭代之后基本上是休息.如何使用app引擎的内置模板引擎(django 0.96)来解决这个问题?
卢克斯的回答解决了我自动插入休息的问题.
但是我仍然需要找到一种方法来检查每个数字是否存在于列表中并给它一个特定的类.有没有办法实现这样的事情:
{% for number in list }
<td {% if number in another_list %}class="special"{% endif %}>{{number}}</td>
{% endfor }
Run Code Online (Sandbox Code Playgroud)
{% for end_number in end_numbers %}
{% if forloop.counter|divisibleby:"10" %}
</tr>
{% endif %}
{% endfor %}
Run Code Online (Sandbox Code Playgroud)