繁体   English   中英

Django 模板语法错误(无效块标签)

[英]Django Template syntax error (Invalid block Tag)

我想在我的网站上打开我的预订表格页面,但我收到了这个错误:

TemplateSyntaxError at /form.html/
 Invalid block tag on line 61: 'end', expected 'empty' or 'endfor'. Did you forget to register or 
 load this tag?

这是我的代码:

     {% if messages %}
     {% for message in messages %}
      <h2 style="color: green">{{message}}</h2>
      {% end for %} //the line I got the error
     {% end if %}

结尾和关键字之间不应有空格。

{% if messages %}
  {% for message in messages %}
    <h2 style="color: green">{{message}}</h2>
  {% endfor %}
{% endif %}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM