title: Python: SelectField "Not a valid choice"
body: <p><strong>form.py</strong></p>
  
  <pre><code>class Confirm(CSRFForm):
      monitor_updates = SelectField(
          lazy_gettext("Monitor updates of an app"),
          validators=[validators.Optional()], choices=[], coerce=int
      )
  </code></pre>
  
  <p><strong>view.py</strong></p>
  
  <pre><code>def upload_confirm():
      form = Confirm()
  
      if form.validate_on_submit:
          if form.monitor_updates.data == 0:
              current_workflow.installation_source.monitor_updates_id = None
              db.session.commit()
          else:
              current_workflow.installation_source.monitor_updates_id = form.monitor_updates.data
              db.session.commit()
  
      choices = [(app[1][0], app[1][1]) for app in list_choices]
      form.monitor_updates.choices =[(0, "Nothing matches")]
      form.monitor_updates.choices += choices
  </code></pre>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>class InstallationSource(db.Model):
  
      monitor_updates_id = db.Column(db.Integer, db.ForeignKey('updates_software.id'))
  </code></pre>
  
  <p>When filling out the form and selecting "Nothing matches" in the dropdown with a value of 0, I get an error.</p>
  
  <p><a href="https://i.stack.imgur.com/eiI5v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eiI5v.png" alt="screenshot"></a></p>
  
  <p>If you select a different value, the save is correct.
  I can only use the number <code>0</code>, because all other numbers can be occupied</p>