Django template keyword `choice_value` in no longer work in 1.11

空扰寡人 提交于 2019-12-05 01:03:41

As @L_S 's comments. I debug with dir(form), all value contained in form.project.data here's the correct code:

{% for choice in form.project %}
<labelc for="{{ choice.id_for_label }}">
    <input type="checkbox" name="{{ choice.data.name }}" id="{{ choice.id_for_label }}" 
    value="{{ choice.data.value }}"{% if choice.data.selected %} checked{% endif %}>
    {{ choice.data.label }}
</label>
{% endfor %}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!