I'm trying to make the entire column colorful, but only the last line is getting.
I've tried all the possible logic, but I'm not getting it right.
This post is a continuation of Total and subtotal in django template using lists .
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>