比如我有一个字段是性别,定义models和定义form表单的时候需要分别怎么写,,,网上查了,木有看到示例,,求大神
有木有人在哇,,,
WTForms
的 RadioField
例子 https://gist.github.com/doobeh/4667330
我使用的是wtforms里面的SelectField
from wtforms import SelectField
select = SelectField('性别', choices=[('female','female'), ('male', 'male')], validators=[DataRequired()], coerce='str')
这种是一个单选的下拉菜单