使用 wtforms 我正在尝试格式化以下表单。所以我有 evrything 工作,但我不需要 'FormField' 被包裹的 html 表 - 那么如何绕过/覆盖它呢?
class WeekdayHoursForm(BaseForm):
hours = [(str(x+1), str(x+1)) for x in range(12)]
mins=[('00',':00'),('15',':15'),('30',':30'),('45',':45')]
fromHour = SelectField('',choices=hours)
fromMin = SelectField('',choices=mins)
toHour = SelectField('',choices=hours)
toMin = SelectField('',choices=mins)
closed = BooleanField('Closed','0')
class AddListingForm(BaseForm):
monday = FormField(WeekdayHoursForm)
tuesday = FormField(WeekdayHoursForm)
etc...
我的观点
<div class="wrapper-block weekday" id="mon">
{{ form.monday.label }} {{ form.monday() }}
</div>
<div class="wrapper-block weekday" id="tues">
{{ form.tuesday.label }} {{ form.tuesday() }}
</div>
我省略了生成的 HTML,但如果需要,我可以将其粘贴 - 我知道 wtforms FormField 使用“TableWidget”,但我不知道在哪里设置它'with_table_tag = False'
?