【发布时间】:2020-07-09 09:44:09
【问题描述】:
我在 django 模板中使用嵌套的 for 循环来打印我从数据库中获取的数据
{% if objectives %}
{% for obj in objectives %}
{% for sobj in sobjective %}
{% if sobj.id==obj.id %} yes {% endif %}
所有打开的标签都关闭了
但它会引发错误 正如我上面提到的
TemplateSyntaxError at /objectives
Could not parse the remainder: '==obj.id' from 'sobj.id==obj.id'
【问题讨论】:
-
在
==周围添加空格。 -
你看过in this question提到的解决方案了吗?错误可能不在您提供的代码 sn-p 中。
标签: python django python-3.x django-templates