gpt4 book ai didi

python - 在 Bottlepy 待办事项教程中使用行 ID 的 anchor 标记

转载 作者:太空宇宙 更新时间:2023-11-03 15:41:10 24 4
gpt4 key购买 nike

这是一个模板,它采用数据库表的行和单独字段中的字段。我对此很陌生。

  <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 的 anchor 标记以及上面每一行中的查询 id。我怎样才能做到这一点?

http://domain.com/edit/ 行 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>

关于python - 在 Bottlepy 待办事项教程中使用行 ID 的 anchor 标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42106609/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com