我正在生成一个带有 wtforms 的 html 表单,如下所示:
<div class="control-group">
{% for subfield in form.time_offset %}
<label class="radio">
{{ subfield }}
{{ subfield.label }}
</label>
{% endfor %}
</div>
我的表单类是这样的:
class SN4639(Form):
time_offset = RadioField(u'Label', choices=[
('2', u'Check when Daylight saving has begun, UTC+02:00'),
('1', u'Check when Daylight saving has stopped, UTC+01:00')],
default=2, validators=[Required()])
当我现在打开编辑表单时,我通过 SQL 获得值 1 或 2 - 如何预设指定单选按钮?