我将以下字典传递给一个呈现函数,其中源是一个字符串列表,标题是一个可能等于源中一个字符串的字符串:
{'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 '{{'
.其中{% if title == {{ source }} %}
以红色突出显示.