1 回答
TA贡献1827条经验 获得超9个赞
Change your html page, you just need to change your if condition.
<button class="accordion">Commentaires</button>
<div class="panel">
{% for e in ex %}
<h5>{{e.Student.Name}} {{e.Student.Surname}}, parti en {{e.StartDate}} ({{e.Year}}A {{e.Student.INSADepartement}} S{{e.Semester}})</h5>
{% if e.Comment %}
<blockquote>{{e.Comment}}</blockquote>
{% endif %}
{% endfor %}
</div>
And if you don't want to display anything, if there is no comment. Then your html page should be like this
<button class="accordion">Commentaires</button>
{% for e in ex %}
{% if e.Comment %}
<div class="panel">
<h5>{{e.Student.Name}} {{e.Student.Surname}}, parti en {{e.StartDate}} ({{e.Year}}A {{e.Student.INSADepartement}} S{{e.Semester}})</h5>
<blockquote>{{e.Comment}}</blockquote>
</div>
{% endif %}
{% endfor %}
添加回答
举报