Skip to content

Conversation

@smsearcy
Copy link

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

If a column has a default value, then make the input field optional when
generating a form object from a model.
@smsearcy
Copy link
Author

smsearcy commented May 10, 2024

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.

@smsearcy smsearcy marked this pull request as draft May 10, 2024 17:51
@smsearcy smsearcy marked this pull request as ready for review May 10, 2024 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Non-nullable columns with a default value should be optional

1 participant