Django Template Keyword `choice_value` In No Longer Work In 1.11
There is a multiple checkbox in template, if value contain in render the choice will checked by default. It works well with 1.10. form.py: class NewForm(forms.Form): project =
Solution 1:
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 %}
Post a Comment for "Django Template Keyword `choice_value` In No Longer Work In 1.11"