在 bottlepy 待办事项教程中使用行 id 的锚标记
Anchor tag using row id in bottlepy to-do tutorial
这是一个模板,它采用数据库的行 table 和单独字段中的字段。我是新手。
<table border="0" class="table table-hover">
%for row in rows:
<tr>
%for col in row:
<td>
<b>
{{col}}
</b>
</td>
%end
</tr>
%end
</table>
我想在上面的每一行中使用带有特定 url 和查询 ID 的锚标记。我该怎么做?
你的意思是这样的吗?
<!doctype html>
<table border="0" class="table table-hover">
%for row in rows:
<tr>
%for i in range(len(row)):
<td>
%# assuming you want to display col == 3 to as a link
%# and the row id is in col == 0
%if i == 3:
<a href=" http://domain.com/edit/{{row[0]}}">{{row[i]}}</a>
%else:
<b>{{row[i]}}</b>
%end
</td>
%end
</tr>
%end
</table>
这是一个模板,它采用数据库的行 table 和单独字段中的字段。我是新手。
<table border="0" class="table table-hover">
%for row in rows:
<tr>
%for col in row:
<td>
<b>
{{col}}
</b>
</td>
%end
</tr>
%end
</table>
我想在上面的每一行中使用带有特定 url 和查询 ID 的锚标记。我该怎么做?
你的意思是这样的吗?
<!doctype html>
<table border="0" class="table table-hover">
%for row in rows:
<tr>
%for i in range(len(row)):
<td>
%# assuming you want to display col == 3 to as a link
%# and the row id is in col == 0
%if i == 3:
<a href=" http://domain.com/edit/{{row[0]}}">{{row[i]}}</a>
%else:
<b>{{row[i]}}</b>
%end
</td>
%end
</tr>
%end
</table>