【发布时间】:2018-03-11 03:55:55
【问题描述】:
我想在模板中创建一个按钮,如果我按下 View,我希望显示一个弹出窗口,并且在该弹出窗口中我想显示来自 models.py 的表格。
基本上,我希望该弹出窗口包含所有列名和该表格显示的所有日期。如果可能的话,使用分页。
这是我的 seaerch_table.html
的一部分<script>
$("#mytable").dialog({autoOpen: false});
$("#opener").click(function () {
$("#mytable").dialog("open");
});
</script>
<table class="table table-bordered sortable table-hover" id="mytable">
<thead>
<tr>
<th>Id</th>
<th>Title</th>
<th>Url</th>
<th>View All Info</th>
</tr>
</thead>
<tbody>
{% for lists in details %}
<tr>
<td>{{ lists.id }}</td>
<td>{{ lists.title }}</td>
<td><a href="{{ lists.url }}" target="_blank">{{ lists.url }}</a></td>
<td>
<button id="opener">View</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
它只在模板中显示 3 个字段...我想在弹出窗口时再添加 2 个字段,其中包括 Createdat 和 Descriptions 字段。我不想在那个弹出窗口上做任何特别的事情...只显示 mysql 中的整个表(包括创建的列at 和 description)
有人可以帮我吗?
谢谢
【问题讨论】: