I am trying to show only the element saved in the database that corresponds to the other element. When I do this out of the script, it works perfectly, but when I play in the script it returns all the elements.
I'll put a part of the code:
Part of the script that does not work
<script>
function mostrarSel(){
x = "{% for questao in prova.questao_set.all %}{% for resposta in questao.resposta_set.all %}{{resposta.resposta}}{% endfor %}{% endfor %}";
alert(x);
}
</script>
Part that works out of script
{% for questao in prova.questao_set.all %}
<div id="minhaDiv" style="display: none;">Resposta:
{% for resposta in questao.resposta_set.all %}
{{resposta.resposta}}
{% endfor %}
</div>
{% endfor %}
For those who want to see the full code: link