As long as you pass the bools to the selection, only strings are used in the HTML values. Thus, you will have a choice of 'True'
and 'False'
. Both are non-empty strings, so when a value is cast to a value bool
, they are both evaluated as True
. You will need to use another called object that does the right thing for the string 'False'
.
InputRequired
DataRequired
. , , , .
SelectField(
choices=[(True, 'Yes'), (False, 'No')],
validators=[InputRequired()],
coerce=lambda x: x == 'True'
)