【问题标题】:Django TemplateSyntaxError: Could not parse remainderDjango TemplateSyntaxError:无法解析余数
【发布时间】:2013-10-04 22:13:24
【问题描述】:

我是 Django 初学者,正在使用 this youtube 教程构建博客。下面的代码行在博客正文的末尾添加了一个可点击标签列表。

<div class="tags">
    {% for tag in post.tags.all %}
        <a href="blog/tag{{tag}}" >{{tag}}</a>
        {%  if not forloop.last %},{% endif %}
    {{% endfor %}}
</div>

但是,我在第二行收到此错误:

TemplateSyntaxError at /blog/
Could not parse the remainder: '% endfor %' from '% endfor %'

任何帮助将不胜感激。谢谢。

【问题讨论】:

    标签: django django-templates


    【解决方案1】:

    你在这里是双括号{{% endfor %}}它需要是单的:

    {% endfor %}
    

    【讨论】:

      猜你喜欢
      • 2023-02-08
      • 2020-06-20
      • 2018-08-31
      • 2011-07-11
      • 2015-03-06
      • 2011-11-06
      • 2018-03-31
      • 2015-03-17
      • 1970-01-01
      相关资源
      最近更新 更多