0
我應該如何在template.html中命名我的選擇標籤,以便在每次接收到POST消息時能夠將它們分別關聯到views.py中?如何在html中動態命名標籤以便稍後與它們關聯?
<div style="display: inline-block;">
{% for type in range(form.typesCount) %}
<div>
<select name="???">
{% for format in formats %}
<option value="{{format}}"> {{ format }}</option>
{% endfor %}
</select>
</div>
{% endfor %}
</div>
有趣的是,爲什麼loop.index從1開始? – sramij
'loop.index0'從零開始。請參閱上面的文檔鏈接。 – darksky