我将下面的字典传递给一个render函数,其中source是一个字符串列表,title是一个字符串,它可能等于source中的一个字符串:
{'title':title, 'sources':sources})
在HTML模板中,我想在以下几行中完成一些工作:
{% for source in sources %}
<tr>
<td>{{ source }}</td>
<td>
{% if title == {{ source }} %}
Just now!
{% endif %}
</td>
</tr>
{% endfor %}
但是,以下文本块会导致错误:
TemplateSyntaxError at /admin/start/
Could not parse the remainder: '{{' from '{{'
...with {% if title == {{ source }} %}
以红色突出显示。
https://stackoverflow.com/questions/11372177
复制相似问题