我的for循环正在工作,但当if包含在模板中时,它在django中不起作用

时间:2017-03-25 10:00:42

标签: django django-templates

这是我模板的代码。 is_hod字段是布尔字段

<table class="table" style="text-align: left;">
    <thead>
    <tr>
        <th>Requested by</th>
        <th>Requested on</th>
      </tr>
    </thead>
    {% for request in all_requests %}
    <tbody>
      {% if retest.is_hod %}       
      <tr>
       <td>{{ request.name }}</td>
       <td>{{ request.date }}</td>
       <td><button onclick="location.href= '/retest/{{ request.id }}/';">View details</button></td>
       <tr>
      {% endif %}    
    </tbody>
    {% endfor %}
</table>

0 个答案:

没有答案