2
I’m trying to leave the whole column colored, but only the last line is getting.
I’ve tried every possible logic, but I’m not getting it right.
This post is a continuation of Total and subtotal in Django template using lists.
py views.
...
    # loja mais barata
    loja_mais_barata = min(linhas[-1][1:])[3]
...
html template.
<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>

@mgibsonbr think this business will not end. But I think this is the last. hehe
– Regis Santos
You know I am not notified when you use @ a question I didn’t participate in, right? : P (if I don’t find your question alone, I won’t even know it exists...)
– mgibsonbr
It’s that line that’s not working as it should?
{% if item.3 == loja_mais_barata %}Your logic seems correct to me, I can’t see where the error might be.– mgibsonbr
@mgibsonbr Merry Christmas. So it seems correct yes, but it is not coloring the whole column :(
– Regis Santos