小编Max*_*lov的帖子

传递复选框值以在 django 中查看

我有一个包含一些数据库数据的表

<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>
Run Code Online (Sandbox Code Playgroud)

我想在每个字段中添加一个复选框,并传递选中数据的 id 来查看并进行组操作,而不是逐一删除项目。我添加了这个复选框

<input type="checkbox" name="inputs" id="option{{input.id}}" value={{input.id}} />
Run Code Online (Sandbox Code Playgroud)

我应该如何传递所有检查的值来查看?是这样的吗?

django checkbox django-templates django-views

5
推荐指数
1
解决办法
8768
查看次数

标签 统计

checkbox ×1

django ×1

django-templates ×1

django-views ×1