【发布时间】:2021-09-05 22:22:33
【问题描述】:
我有一个用户表,一个表数据是一个打开模式的按钮,我在模板中包含了带有include 标记的模式。如何将用户从单击按钮的行传递到包含标签?
{% for user in users %}
<tr>
<td>
<button class="btn btn-lg device-select-button">
<span>Select Device</span>
</button>
</td>
</tr>
{% endfor %}
{% include 'app/admin/users/device_select_modal.html' user={{add here user}} %}
在其他实现中,我为每一行生成了一个模态,它工作但很慢,所以我想重新实现它
【问题讨论】:
-
我认为您需要 JavaScript 才能做到这一点。 AFAIk 模板仅在您加载页面时构建一次,无法告诉它等待用户点击。另请参阅this question。
标签: python html django django-templates