我的 .html
模板有问题。无法确定第 49 行的错误。说预期的 endif
而我实际上在代码中有它。
错误说:
Invalid block tag on line 49: 'endfor', expected 'elif', 'else' or 'endif'.
44 {% if messages %}
45 {% for message in messages % }
46 <div class=" alert alert-{{message.tag}}">
47 {{message}}
48 </div>
49 {% endfor %}
50 {% endif %}
非常感谢任何帮助。
最佳答案
这里可能有错误:
1 %
之间的空格太多
{% for message in messages %}
关于html - Django:第 49 行无效的 block 标记: 'endfor',应为 'elif'、 'else' 或 'endif'。您是否忘记注册或加载此标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59667781/