0
I’m having difficulty here to display the return of a Boolean field in the template. I need to display the field name if it is true in the template.
models
topo = models.BooleanField()
views
def view_ieis(request, pk):
ieis = IEIS.objects.get(pk=pk)
return render(request, 'ieis/view.html', {'ieis': ieis,})
html template.
<div table class="table table-reponsive">
<table class="table table-bordered">
<thead>
<tr>
<th scope="col">Tipo</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{% if topo is True %}
<p>Topo</p>
{% endif %}
</td>
</tr>
</tbody>
</table>
</div>