mardi 16 juin 2015

Passing checkboxes values to view in django

I have a table with some database data

<table id="id_list_table" class="table table-condensed">
<caption>Inputs list</caption>
    <thead>
      <tr>
        <th>#</th>
        <th id="input">Input</th>
      </tr>
    </thead>
    <tbody id="fbody">
    {%for input in InputsAll%}
        <tr>
            <td>{{ input.input }}</td>
            <td>
                <a class="btn btn-primary btn-xs" href="{% url 'edit' %}?input_num={{input.id}}" id="edit">edit</a>
                <a class="btn btn-danger btn-xs" href="{% url 'delete' %}?input_num={{input.id}}" id="remove">remove</a>
                <a class="btn btn-success btn-xs" href="{% url 'resolve' %}?input_num={{input.id}}"id="resolve">resolve</a>
                <input type="checkbox" name="inputs" id="option{{input.id}}" value={{input.id}} />
            </td>
        </tr>
    {%endfor%}
    </tbody>
</table>

and i want to add a checkbox to every field and pass checked data's id to view and make group action instead of remving items one by one. i added this checkbox

<input type="checkbox" name="inputs" id="option{{input.id}}" value={{input.id}} />

and how should i pass all checked values to view? Does it work this way?




Aucun commentaire:

Enregistrer un commentaire