我有一个django模板,其中包含一个表和一些记录。单击单选按钮我想通过获取请求获取views.py中的特定记录值。 for循环不起作用..请提示
{% for request in requests %}
<tr>
<td>
<tr>
<td><input type ="text" value ={{ request.workflowId}} readonly name ="workflid" STYLE="background-color: pink;" /></td>
<td><input type ="text" value ={{ request.proj_name}} readonly name ="projname" STYLE="background-color: pink;" /></td>
<td><input type ="text" value ={{ request.task }} readonly name ="id1" STYLE="background-color: pink;" /></td>
<td><input type ="text" value ={{ request.date }}readonly name ="id1" STYLE="background-color: pink;" /></td>
<td><input type ="text" value ={{ request.enteredby }} readonly name ="id1" STYLE="background-color: pink;" /></td>
<td> <input type = "text" align ="center" readonly name = "status" value = {{ request.status }} STYLE="background-color: pink;" /></td>
<td><input type = "text" value ={{ request.assignto }} readonly name = "asgnto" STYLE="background-color: pink;" /></td>
<td><input type = "radio" name ="radio1" onclick ="validate_values()"</td>
</tr>
</td>
</tr>
{% endfor %}
答案 0 :(得分:0)
在method="GET"
的表单中放入action="/yoururl/{{request.workflowId}}/"
所以使用id的值到url中,你可以将特定的字段值区分到你的视图中。