在下面的代码中,educationData是数据库查询结果和范围函数的压缩文件。
我在同一个HTML页面中有一个完全相似的条件。现在的问题是,每次只有其中一个工作,即如果下面的条件有效,那么另一个不起作用。
{% if educationData != 'unavailable' %}
{% for edu, counter in educationData %}
<div class="row">
<div class="circ"></div>
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse{{counter}}" aria-expanded="false"aria controls="collapse{{counter}}" class="collapsed expand-date">{{edu.year}}</a>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading{{counter}}">
<h4 class="panel-title">
<span aria-controls="collapse{{counter}}">
<span class="accordion-heading">{{edu.education_type}}</span>
</span>
</h4>
</div>
<div id="collapse{{counter}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading{{counter}}">
<div class="panel-body">
<h4 class="timeline-title">Started <span><strong>{{edu.education_type}}</strong></span> at <span><strong>{{edu.institution_name}}</strong></span></h4>
<div class="timeline-body">
<p>{{edu.what_did_you_do_there}}</p>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}
{% if educationData == 'unavailable' %}
<p>Not Available</p>
{% endif %}
请帮忙。坚持:(
答案 0 :(得分:0)
尝试使用{% elif %}
?
{% if educationData != 'unavailable' %}
<loop here>
{% elif educationData == 'unavailable' %}
<other html here>
{% endif %}