python - 如何将表格的数据从 Html 传输到 view.py (Python)
问题描述
我正在使用 Django,我想将一些数据转换为 view.py。我想知道是否有指南或方法可以做到这一点。假设我想将以下内容转换为 view.py
<table class="table table-bordered table-striped">
<thead>
<!-- Columnas de la tabla -->
<tr>
<th scope="col">Nombre huesped</th>
<th scope="col">Rut huesped</th>
<th scope="col">Telefono</th>
<th scope="col">N° de habitacion</th>
<th scope="col">Tipo de plato</th>
<th scope="col">borrar</th>
</tr>
</thead>
<tbody id="filas">
<!-- Fila 1 de la tabla -->
</tbody>
</table>
解决方案
我认为这可以通过将其作为 HTTPResponse 返回来实现:
def index(request):
return HttpResponse("""<table class="table table-bordered table-striped">
<thead>
<!-- Columnas de la tabla -->
<tr>
<th scope="col">Nombre huesped</th>
<th scope="col">Rut huesped</th>
<th scope="col">Telefono</th>
<th scope="col">N° de habitacion</th>
<th scope="col">Tipo de plato</th>
<th scope="col">borrar</th>
</tr>
</thead>
<tbody id="filas">
<!-- Fila 1 de la tabla -->
</tbody>
</table>""")
推荐阅读
- css - React-Router NavLink 活动颜色
- ngrok - ngrok:使用本地主机子域
- c - 在 C 中传递指向函数的指针时的困惑
- python - How does `points` work in `integrate.quad`?
- c# - 如何使用 Visual Studio 安装项目为 .net 核心(单个 exe)应用程序创建安装程序?
- python - 稀疏向量的快速余弦相似度
- azure - ARM 模板 - Windows 虚拟桌面 - Microsoft.DesktopVirtualization/hostpools 在 CanadaEast 不可用
- firebase - Flutter firebase_storage FirebaseStorage.instance():表达式不计算为函数,因此无法调用
- java - 由于 NoSuchMethodException,Spring Boot azure 函数无法启动
- android - 不打算从我导入的项目库中打开下一个活动