Django templates to generate checkbox problems

The system assumes a software testing for the submission page,
A column is displayed in the form of checkbox department all staff,
The application of the submitter can choose some developers.

This' all department staff 'display is a Django template {% for in%} circulation generated several checkbox, as follows

{% for item in names %}
<input type="checkbox" name="names" value={{ item.id }} >{{ item.name }}
{% endfor %}


If I submitted the form selected first and third.
I think when I later editing of this application, the first and the third one is automatic in the selected state,
How to achieve this function?

Started by Chris at February 04, 2016 - 5:56 AM

Checkbox has a property called "checked", if you have this property, checkbox will begin in the selected state.

Comparison:

<input type="checkbox" name="names" value="check1" >not selected

And

<input type="checkbox" name="names" value="check2" checked>selected

Posted by Blair at December 27, 2016 - 3:35 AM

Notice that the checked value of no use, only the existence of the state. The following checkbox is selected:


<input type="checkbox" name="names" value="check2" checked="false">selected

Posted by Blair at January 02, 2017 - 5:07 AM

But also to remember in session.

Posted by Isaac at January 09, 2017 - 3:52 AM

The properties of check seems useless, estimation is placed in the session, but the specific how to do not know, ,

Posted by Alex at January 13, 2017 - 4:38 AM