【发布时间】:2019-11-19 03:35:00
【问题描述】:
我为我的网站项目做了一个标题,它有一些部分...... 我想使用 jinja 更改标题上的部分颜色名称,但我不能 模板已无错误地呈现,但部分名称未更改 并且在 pycharm 中显示此消息:标签开始未关闭
<ul class='menu'>
<li {% if section == "dashboard" %}class="selected"{% endif %}>
<a href="{% url 'dashboard' %}">My dashboard</a>
</li>
<li {% if section == "images" %}class="selected"{% endif %}>
<a href="#">Images</a>
</li>
<li {% if section == "people" %}class="selected"{% endif %}>
<a href="#">People</a>
</li>
</ul>
【问题讨论】:
-
你能在你的视图中显示
print((section, type(section)))显示的内容吗?或许section不是字符串,或者是不同值的字符串?
标签: python html django python-3.x jinja2