如何使這個循環打印表單域XXXXXXXX是ticket.id的值?Django模板:表單字段名稱作爲變量?
{% for ticket in zone.tickets %}
{{ ticket.id }}: {{ form.ticket_count_XXXXXXXX }}
{% endfor %}
所以輸出是這樣的......
1: <input ... name="ticket_count_1">
10: <input ... name="ticket_count_10">
12: <input ... name="ticket_count_12">
3: <input ... name="ticket_count_3">
我喜歡這樣:http://stackoverflow.com/a/12307727/177293 –