【发布时间】:2016-03-10 11:06:04
【问题描述】:
我有一张桌子,如果 person.storyPublished 的值为 true,我想更改 tr 的背景颜色,否则什么也不做。
我的代码如下所示:
{% for person in people %}
<tr class="row-person {% '.row-story-published' if person.storyPublished else ' ' %}" >
<td>
{{ person.name }}
</td>
...
我收到此错误:
jinja2.exceptions.TemplateSyntaxError
TemplateSyntaxError: tag name expected
CSS 部分在这里:
<style>
.row-story-published{
background-color: #b3ffb3;
}
</style>
为什么会这样?我想念什么我没有注意到?任何帮助:)
【问题讨论】:
标签: python css python-2.7 jinja2