我是FE网的新手,
我正在尝试显示一个数据表,该数据表是由包含列表的字典构造的。 mt后端是python瓶。
这是我的mako代码:
<div class="row align-to-center">
<table id="example" class="display" style="width:100%">
<thead>
<tr>
<th>Source</th>
<th>Destination</th>
<th>Service</th>
<th>Action</th>
<th>Source zone</th>
<th>Destination zone</th>
<th>UID</th>
</tr>
</thead>
<tbody>
% for key, value in rules.items:
% for src in value["src_network"]:
% for dst in value["dst_network"]:
% for service in value["dst_service"]:
<tr>
<td>${src["name"]}</td>
<td>${dst["name"]}</td>
<td>${service["name"]}</td>
<td>${value["action"]}</td>
<td>${value["from_zone"]}</td>
<td>${value["to_zone"]}</td>
<td>${key}</td>
</tr>
% endfor
% endfor
% endfor
% endfor
</tbody></table>
</div>
您正在尝试迭代一个函数对象。您必须调用.items方法。
将% for key, value in rules.items:
更改为% for key, value in rules.items():