1
I’m new in Django and I’m having a problem with the tags Template
My code:
{% load static %}
{% block content %}
<div>
{{ questao.afirmativa }}
</div>
{% alternativas = questao.get_alternativas %}
<table>
<tr>
{% for alternativa in alternativas %}
<td>{{alternativa}}</td>
{% end for %}
</tr>
</table>
{% endblock content %}
The object questao
is already in the context
of view
. The method get_alternativas
generates a list of alternatives that I want to go through with the for
and show on the page.
What am I doing wrong?
You’re making a mistake on that line:
{% alternativas = questao.get_alternativas %}
Error message:
"- Invalid block tag on line 7: 'alternatives', expected 'endblock'. You forgot to register or load this tag?"