I would like to know if there is any way to refine the ELIF within a FOR, so that it does not enter in the FOR whenever the date does not exist, but rather if that date does not exist.
Here's the problem:
For each meeting date
{%for u in i.chamada_set.get.datas_encontros.filter|dictsort:"data_ano"%}
Sign in for each completed date
{% for a in i.chamada_set.get.finalizada_set.filter %}
And check if:
{%if a.data_finalizada|date:"d, m, Y" == u.data_ano|date:"d, m, Y"%}
The date ended is equal to the date of the meeting, but if I have 3 dates completed, only 1 would fall in that if and the other 2 in the
Then I thought about ELIF
{%elif u.data_ano|date:"d, m, Y" not in a.data_finalizada|date:"d, m, Y" %}
But continued entering because the other dates ended, are not equal to the date encounter.
Image:
Ingreenarethefinisheddates,inPersonOne,havethefollowingdateorderended[06/11/2018,08/11/2018,11/13/2018]
Themainideawouldbetoshowthatyoudidnotfindthedate,anditworkswhenyouhaveonlyonedate(PersonTwoandPersonThree).
TRcode:
{%foryini.chamada_set.get.alunos.filter%}<tr><td>{{y.nome_aluno}}{{y.sobrenome_aluno}}</td><td>{{y.cgu_aluno}}</td>{%foruini.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%}