Skip to content

Model forms with a non-nullable select column with default not being validated for blank value #170

@pytrumpeter

Description

@pytrumpeter

I created a form which contains a select field, based on a column that is both non-nullable and has a default specified on the entity. When the field is rendered by the default form rendering, it contains a blank value (by design) but when that blank value is selected and the form submitted, there is no validation happening, and an integrity error results: null value in column violates not-null constraint

The workaround is to specify the SelectField explicitly and include validators=[InputRequired()]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions