I'm trying to put the names of the coordinators in the options of a select looking for the database, I've already researched and it seems that there is another way to use the select in django, but it was not very clear, so I'm posting here my code to see if someone can clear up my doubts.
This is the part of views:
contexto ={
'coordenadores': Coordenador.objects.all()
}
...
return render(request, 'formDisciplina.html', contexto)
Here is the template below:
<p><label name='idcoordenador'>Coordenador: </label>
<select name='idcoordenador'>
<option>-----Selecione-----</option>
{% for a in coordenadores %}
<option values= {{ a.id }}> {{ a.name }} </option>
{% endfor %}
</select>
</p>