无法分析“sobj.id==obj.id”中的其余部分:“==obj.id”

2024-09-28 22:56:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用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'

Tags: 数据djangoin模板id数据库objfor