【发布时间】:2017-03-20 09:31:18
【问题描述】:
我将一个列表(即data_code)从view.py 传递到一个html 文件,然后我使用for 循环在列表中打印表格的数据。表<input> 中有一个可编辑的列,我想在用户填写我的view.py 后获取这些数据。所以有人知道怎么做吗?
我想在view.py 中获取所有{{x.2}}。它正在打印一些默认值,但在用户使用后我又想要它。
代码如下:
<table class="table table-bordered datatable">
<thead class="table-head">
<tr>
<th>No</th>
<th>Code Point</th>
<th>Reference</th>
<th>Character</th>
<th>Text</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{% for x in data_code %}
<tr class="table-row">
<td>{{ forloop.counter }}</td>
<td><label>{{ x.0 }}</label></td>
<td><input id="codepoint_input" type="text" value={{x.2}} size=3 title="Text"></td>
<td><label> {{x.3}}</label></td>
<td>{{x.4}}</td>
</tr>
{% endfor %}
</tbody>
</table>
【问题讨论】:
-
查找 django 表单
-
@e4c5 你不能给我一些提示吗?
-
这就是我所做的
-
我阅读了 django 表单,但没有得到任何好的示例。所以如果你能举个例子就好了。
标签: python django django-forms django-templates django-views