Estou tentando deixar toda a coluna colorida, mas somente a última linha é que está ficando.
Tentei toda a lógica possível, mas não estou conseguindo acertar.
Este post é uma continuação de Total e subtotal em template do django usando listas.
views.py
...
# loja mais barata
loja_mais_barata = min(linhas[-1][1:])[3]
...
template.html
<tbody>
{% for linha, mais_barato in linhas_mais_barato %}
{% if linha.0 == 'Subtotal' %}
<tr class="info" style="font-weight: bold;">
{% else %}
<tr>
{% endif %}
{% for item in linha %}
{% if forloop.first %}
<td>{{ item }}</td>
{% elif forloop.last %}
{% else %}
{% if item.3 == loja_mais_barata %}
<td>OK</td>
{% else %}
<td>{{ item.0 }}</td>
{% endif %}
<td>{{ item.1 }}</td>
<td>{{ item.2 }}</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
<tr>
{% for item in cabecalho %}
{% if forloop.first %}
<th> </th>
{% else %}
<td class="text-center">Preço</td>
<td class="text-center">Quant.</td>
<td class="text-center" style="border-right: 1px dashed #333;">Total</td>
{% endif %}
{% endfor %}
</tr>
<tr>
{% for item in cabecalho %}
{% if forloop.first %}
<th>{{ item }}</th>
{% else %}
<th class="text-center"></th>
<th class="text-center">{{ item }}</th>
<th class="text-center"></th>
{% endif %}
{% endfor %}
</tr>
</tbody>
{% if item.3 == loja_mais_barata %}
Sua lógica me parece correta, não consigo enxergar onde pode estar o erro.