【发布时间】:2013-04-18 03:17:48
【问题描述】:
我对html中的表格不太擅长,所以这个问题可能很容易回答。
我将列表 {{ attributes }} 传递给模板,我想创建一个包含 2 行和多列的表。
模板:
<div id="table">
<table border=0>
{% for attr in attributes %}
<td>
<th>{{ attr.0 }}</th>
{{ attr.1 }}
</td>
{% endfor %}
</table>
</div>
我希望{{ attr.0 }} 成为标题并显示在单行上,{{ attr.1 }} 显示在第二行上。
【问题讨论】:
-
您在
中有一个 ,这是不正确的。 {{attributes}} 包含什么? {{attributes}} 是列表 [['header','value'], ... ]]
标签: html django django-templates