У меня есть HTML-таблица, которая заполняется на основе значения в базе данных.
Как я могу установить, какой переключатель выбран на основе значения базы данных при загрузке формы.Я пробовал код ниже, но он ничего не проверяет.Спасибо
<table class="table table-bordered table-hover table-sm">
<thead class="thead-light">
<tr>
<th scope="col"><h4>Id</h4></th>
<th scope="col"><h4>Requirement Name</h4></th>
<th scope="col"><h4>Remarks</h4></th>
<th scope="col"><h4>Date Promised</h4></th>
<th scope="col"><h4>Completed</h4></th>
</tr>
</thead>
<tbody>
{% for req in requirements %}
<tr>
<th><input type="hidden" name="requirements_id_{{req.pk}}" value="{{ req.pk }}"><span>{{ req.pk }}</span></th>
<th><span>{{ req.requirement }}</span></th>
<th><textarea rows="1" cols="35" name="requirements_remarks_{{req.pk}}">{{ req.remarks }}</textarea></th>
<th><input type="date" name="requirements_date_promised_{{req.pk}}" value="{{ req.date_promised|date:'Y-m-d' }}"></th>
<th><input type="radio" name="requirements_completed_{{req.pk}}" value="{{ req.completed }}"> No
<input type="radio" name="requirements_completed_{{req.pk}}" value="{{ req.completed }}"> Yes</th>
</tr>
{% endfor %}
</tbody>
</table>