wtforms-sqlalchemy
wtforms-sqlalchemy copied to clipboard
Columns with a default value should not be required
If a column has a default value, then make the input field optional when generating a form object from a model.
This enables the defaults in the table definition to allow for empty string in a text field and an unchecked checkbox to be submitted.
Closes #47
I just realized I did not test the scenario in which the default value of a boolean column is True. That might require some special handling for the checkboxes, unless WTForms already handles that somehow.
Edit: I verified that a boolean column with default=True will store False to the database.