0
Well, I want to compare two variables coming from a view on Django. I’m doing one for and iterating and comparing a Charfield value (student.matricula) with another Charfield (frequencia.matricula)! I wanted to know if it is possible to do this. My result always falls in Else!
<table>
<tr>
<td>Turma</td>
<td>Matrícula</td>
<td>Nome</td>
<td>Faltas</td>
<td>Data com hora</td>
</tr>
{% for aluno in alunos_tsi %}
<tr>
<td>TSI</td>
<td>{{ aluno.matricula }}</td>
<td>{{ aluno.nome }}</td>
{% for frequencia in frequencias %}
{% if frequencia.matricula == aluno.matricula %}
<td>{{ frequencia.faltas }}</td>
<td>{{ frequencia.data_com_hora }}</td>
{% else %}
<td>0</td>
<td>Nenhuma frequência registrada</td>
{% endif %}
{% endfor %}
</td>
</tr>
{% endfor %}
</table>
Here we do not write "solved" in the question. If you have an answer that really helped you, mark it as accepted. If you came to the solution on your own, put in the solution as an answer. So content is more organized and easier to find in the future by other people with similar problems.
– user28595