Fix validation error when field is disabled
If a selectfield is disabled, None is returned (not a string). To pass wtforms validation, that value shall be part of the choices. We use None as the value for SelectField that are optional (instead of ''). We were previously converting '' to None when creating a model. We now use the coerce function to let the form convert 'None' to None.
Showing
- app/inventory/forms.py 10 additions, 10 deletionsapp/inventory/forms.py
- app/inventory/views.py 6 additions, 6 deletionsapp/inventory/views.py
- app/networks/forms.py 5 additions, 5 deletionsapp/networks/forms.py
- app/networks/views.py 2 additions, 2 deletionsapp/networks/views.py
- app/utils.py 15 additions, 3 deletionsapp/utils.py
Please register or sign in to comment