簡體   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