0
I would like to know if there is any way to refine the ELIF within a FOR, so that it does not enter into it whenever the date does not exist, but if that date specifies it does not exist.
Follow the problem:
For each date meeting
{%for u in i.chamada_set.get.datas_encontros.filter|dictsort:"data_ano"%}
Log in for each completed date
{% for a in i.chamada_set.get.finalizada_set.filter %}
And checks whether:
{%if a.data_finalizada|date:"d, m, Y" == u.data_ano|date:"d, m, Y"%}
The completed date is equal to the date I meet, however, if I have 3 completed dates, only 1 would fall in this if and the other 2 in Else
So I thought about the ELIF
{%elif u.data_ano|date:"d, m, Y" not in a.data_finalizada|date:"d, m, Y" %}
But continued to enter because the other dates completed, are not equal to date.
Imagery:
In green are completed dates, in Person One, has the following order of finalized date [06/11/2018, 08/11/2018, 13/11/2018]
The main idea would be to show that it did not find the date, and it works when it has only one finished (Person Two and Person Three).
Code of the TR:
{% for y in i.chamada_set.get.alunos.filter %}
<tr>
<td>{{y.nome_aluno}} {{y.sobrenome_aluno}} </td>
<td>{{y.cgu_aluno}}</td>
{% for u in i.chamada_set.get.datas_encontros.filter|dictsort:"data_ano"%}
{% for a in i.chamada_set.get.finalizada_set.filter %}
{%if a.data_finalizada|date:"d, m, Y" == u.data_ano|date:"d, m, Y" and y.id == a.aluno_finalizado.id %}
<td style="color:green">
<i class="">encontrou </i>
<i class="">{{u.data_ano|date:"d, m, Y"}}</i>
</td>
{%elif u.data_ano|date:"d, m, Y" not in a.data_finalizada|date:"d, m, Y" and y.id == a.aluno_finalizado.id %}
<td style="color:tomato">
<i class="">não é a data: </i>
<i class="">{{u.data_ano|date:"d, m, Y"}}</i>
</td>
{%endif%}
{%endfor%}
{%endfor%}
</tr>
{%endfor%}