I get the value of a BooleanField but it's always False, even if it's checked.
I think I missed something.
My view :
@bp.route('/update/<int:id>', methods=['GET', 'POST'])
@login_required
note = Notes.query.get_or_404(id)
form = NoteForm()
if form.validate_on_submit():
note.privacy = form.privacy.data # Always got False value, even when it's checked
# ...
Here is the form:
# Some imports
class NoteForm(FlaskForm):
privacy = BooleanField('Private', default=False, validators=[AnyOf([True, False])])
# ...
And the template:
<div class="field">
{{ form.privacy(class="switch") }}
{{ form.privacy.label }}
</div>