Python 将查询从SQLite3数据库显示到引导表中
我想将我的查询从SQLite3显示到引导表中。但它似乎不起作用,也不会在桌子上显示。 随信附上我的密码 views.py HTMLPython 将查询从SQLite3数据库显示到引导表中,python,html,sqlite,flask,bootstrap-table,Python,Html,Sqlite,Flask,Bootstrap Table,我想将我的查询从SQLite3显示到引导表中。但它似乎不起作用,也不会在桌子上显示。 随信附上我的密码 views.py HTML 日期 时间 顾客 照片 类别 描述 2021年12月9日 15:30:00 AB公司。 上下快速移动 网络 网络瘫痪了 2021年12月9日 17:30:00 AB公司。 亚历克斯 计算机 电脑坏了 2021年12月10日 05:32:00 CD公司。 上下快速移动 服务器 服务器已关闭 2021年12月12日 10:30:00 AB公司。 上下快速移动 打印机
日期
时间
顾客
照片
类别
描述
2021年12月9日
15:30:00
AB公司。
上下快速移动
网络
网络瘫痪了
2021年12月9日
17:30:00
AB公司。
亚历克斯
计算机
电脑坏了
2021年12月10日
05:32:00
CD公司。
上下快速移动
服务器
服务器已关闭
2021年12月12日
10:30:00
AB公司。
上下快速移动
打印机
打印机坏了
它应该是这样的,但有来自DB的数据
我读过很多类似的问题,但大多数都使用SQLAlchemy
非常感谢您的帮助您需要在数据中使用循环和模板变量
<tbody>
{% for row in testform %}
<tr>
<td>{{ row[0] }}</td>
<td>{{ row[1] }}</td>
<td>{{ row[2] }}</td>
<td>{{ row[3] }}</td>
<td>{{ row[4] }}</td>
<td>{{ row[5] }}</td>
</tr>
{% endfor %}
</tbody>
{testform%中的行的%s}
{{行[0]}
{{行[1]}
{{行[2]}
{{行[3]}
{{行[4]}
{{row[5]}
{%endfor%}
<div class= "content">
<table id="dtBasicExample" class="table" width="100%">
<thead>
<tr>
<th class="th-sm">Date
</th>
<th class="th-sm">time
<th class="th-sm">customer
</th>
<th class="th-sm">pic
</th>
<th class="th-sm">category
</th>
<th class="th-sm">description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>9 December 2021</td>
<td>15:30:00</td>
<td>AB Corp.</td>
<td>Bob</td>
<td>network</td>
<td>network is down</td>
</tr>
<tr>
<td>9 December 2021</td>
<td>17:30:00</td>
<td>AB Corp.</td>
<td>Alex</td>
<td>computer</td>
<td>computer is broken</td>
</tr>
<tr>
<td>10 December 2021</td>
<td>05:32:00</td>
<td>CD Corp.</td>
<td>Bob</td>
<td>Server</td>
<td>server is down</td>
</tr>
<tr>
<td>12 December 2021</td>
<td>10:30:00</td>
<td>AB Corp.</td>
<td>Bob</td>
<td>printer</td>
<td>printer is down</td>
</tr>
</tbody>
</table>
</div>
<tbody>
{% for row in testform %}
<tr>
<td>{{ row[0] }}</td>
<td>{{ row[1] }}</td>
<td>{{ row[2] }}</td>
<td>{{ row[3] }}</td>
<td>{{ row[4] }}</td>
<td>{{ row[5] }}</td>
</tr>
{% endfor %}
</tbody>