title: Validate that a WTForms BooleanField is checked
body: <p>I am creating a form using Flask-WTForms.</p>
  
  <p>I am using a BooleanField so that a user can indicate they agree terms.</p>
  
  <p>I cannot validate the BooleanField upon submission to ensure that it has been checked. I have tried using Required(), DataRequired() and custom validation but in each case I have not received a validation error.</p>
  
  <p>Here are the nuts and bolts of the application:</p>
  
  <pre><code>from flask import Flask, render_template, session, redirect, url_for, flash
  from flask_wtf import Form
  from wtforms import BooleanField, SubmitField
  from wtforms.validators import Required, DataRequired
  from flask_bootstrap import Bootstrap
  
  app = Flask(__name__)
  app.config['SECRET_KEY'] = 'impossibletoknow'
  
  bootstrap = Bootstrap(app)
  
  class AgreeForm(Form):
      agreement = BooleanField('I agree.', validators=[DataRequired()])
      submit = SubmitField('Submit')
  
  
  @app.route('/', methods=['GET', 'POST'])
  def index():
      form = AgreeForm()
      if form.validate_on_submit():
          agreement = form.agreement.data
          if agreement is True:
              flash('You agreed!')
          return redirect(url_for('index', form=form))
      form.agreement.data = None
      agreement = False
      return render_template('index.html', form=form)
  
  
  if __name__ == '__main__':
      app.run(debug=True)
  </code></pre>
  
  <p>And here is the index.html template...</p>
  
  <pre><code>{% import "bootstrap/wtf.html" as wtf %}
  
  {% block content %}
  &lt;div class="container"&gt;
      {% for message in get_flashed_messages() %}
      &lt;div class="alert alert-warning"&gt;
          &lt;button type="button" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/button&gt;
          {{ message }}
      &lt;/div&gt;
      {% endfor %}
      {{ wtf.quick_form(form) }}
  &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p>Any suggestions would be gratefully received.</p>