dimanche 4 octobre 2015

Flask: How to Set Checkbox to Checked Based on SQLite Database Result

I am making a Flask application and ran into the following problem. On one of my forms, the user checks off various boxes and then the data is sent to the SQLite Database. I want it so that when the user returns to the form, that their checked boxes are checked.

<tr class="mod">
  <td class="number" align="center">1</td>
  <td align="center" class="class">{{ form.monday_mod_1 }}</td>
  <td align="center" class="class">{{ form.tuesday_mod_1 }}</td>
  <td align="center" class="class">{{ form.wednesday_mod_1 }}</td>
  <td align="center" class="class">{{ form.thursday_mod_1 }}</td>
  <td align="center" class="class">{{ form.friday_mod_1 }}</td>
</tr>

How would I set the checkbox to checked from the database result stored in models.Schedule.monday_mod_1 to equal from.monday_mod_1.default
Also where would I place this code. I am using WTForms and have a Schedulee Form Created.

Aucun commentaire:

Enregistrer un commentaire