我想在给定条件下在django模板中减少forloop.counter的值,这在django中是可能的吗?I want to reduce value of forloop.counter by 1 ########### {% if forloop.counter|divisibleby:4 %} {% endif %}
在
假设Django模板的这一部分。regs是Reg对象的列表。Reg.editable是一个BooleanField。我想为列表中的每个元素呈现一个单选按钮。如果r.editable为False,则必须禁用该单选按钮:<input type="radio" value="{{ forloop.counter }}"{% if forloop.first %}checked="checked"{% en