Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: boolean field not using force_values when the form initializes it. #868

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/wtforms/fields/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def __init__(self, label=None, validators=None, false_values=None, **kwargs):
self.false_values = false_values

def process_data(self, value):
self.data = bool(value)
# this will initialize the bool fields with false_values before setting it
self.process_formdata([value])
# self.data = bool(value)

def process_formdata(self, valuelist):
if not valuelist or valuelist[0] in self.false_values:
Expand Down
Loading