【发布时间】:2020-10-15 18:43:11
【问题描述】:
jinja2 无法识别 {% endfor %} 并遇到此错误:
TemplateSyntaxError at endfor in jinja django coding
下面是sn-p的代码:
{% for dest in dests % }
<!-- Destination -->
<div class="destination item">
<div class="destination_image">
<img src="{{im}}/{{dest.img}}" alt="">
<div class="spec_offer text-center"><a href="#">Special Offer</a></div>
</div>
<div class="destination_content">
<div class="destination_title"><a href="{% static 'destinations.html' %}">{{dest.name}}</a></div>
<div class="destination_subtitle"><p>{{dest.desc}}</p></div>
<div class="destination_price">From ${{dest.price}}</div>
</div>
</div>
{% endfor %}
这里dest是一个显示内容的列表。
【问题讨论】:
-
请告诉我们错误。
中的 {{im}} 是什么?
-
{% for dest in dests %
you_have_space_here}