我有一个清单selCategories和一个字典类别。
{{ selCategories }} // prints [1,1,0,0,1]
{% for id,category in categories.items %}
{{ selCategories.0 }} //prints 1
{{ selCategories.id }} //not printing anything
{{ id }} //prints id values such as 1,2,3,4,5
<input type="checkbox" {% if selCategories.id == 1 %} checked {% endif %}>// empty checkbox
{% endfor %}
此处selCategories = [1,1,0,0,1] category = {1:“真实”,2:“教育”,3:“健康”,4:“食品”,5:“旅游”} 我如何获取{{selCategories.id}}的值,以便可以在其他html属性中使用它