title: Flask WTForms BooleanField UnboundField
body: <p>I am writing a script that normally retrieves 5 lines from the database and I want to display it as a checkbox list.</p>
  
  <p>But it doesn't display correctly: it says " UnboundField "</p>
  
  <p><strong>form.py</strong></p>
  
  <pre><code>class ExampleForm(FlaskForm):
      [...query &amp; results...]
      for line in results_sql:
          list_checkbox[line.label] = BooleanField(line.label)
  </code></pre>
  
  <p><strong>routes.py</strong></p>
  
  <pre><code>@bp.route('/example')
  def example():
      form = ExampleForm()
      return render_template("index.html", form=form)
  </code></pre>
  
  <p><strong>index.html</strong></p>
  
  <pre><code>&lt;table class="table table-bordered table-condensed"&gt;
      {% for checkbox in form.list_checkbox %}
      &lt;tr&gt;
          &lt;td&gt;{{ checkbox }}&lt;/td&gt;
          &lt;td&gt;{{ form.list_checkbox[checkbox ] }}&lt;/td&gt;
      &lt;/tr&gt;
      {% endfor %}
  &lt;/table&gt;
  </code></pre>
  
  <p>Result:</p>
  
  <p><a href="https://i.stack.imgur.com/kh3Tg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kh3Tg.png" alt="rendered table"></a></p>