title: Flask WTForms form not submitting but outputs no validation errors
body: <p>I am try to create a basic accounting package using Flask and I am a bit stuck with validating a particular form.  It is working for another form within the same app, but for some reason I can't figure out why this one won't work as well.  The form appears as it should in the web-browser, and I can enter data as normal, but when I come to submit the form, it just seems to reload the page.  My database does not get updated, and after some digging I discovered that my <code>if form.validate_on_submit()</code> isn't catching anything.</p>
  
  <p>There is no error thrown in the stack trace either.</p>
  
  <p>I shall post the relevant sections of my files below.</p>
  
  <p>My <code>views.py</code>:</p>
  
  <pre><code>@app.route('/dashboard/&lt;nickname&gt;/work-orders/add/', methods = ['GET', 'POST'])
  @login_required
  def work_orders_add(nickname):
  ca = check_active(nickname)
  if ca[1] == True:
      form = AddWorkOrderForm()
      u = User.query.get(current_user.id)
      c = u.contacts.order_by('name').all()
      form.requestor.choices = [(contact, contact.name) for contact in c]
      if form.validate_on_submit():
          db.session.add(WorkOrder(requestor = form.requestor.data,
              date = form.date.data,
              notes = form.notes.data,
              total = 0.00,
              completed = form.completed.data,
              user = g.user))
          db.session.commit()
          return redirect(url_for('work_orders', nickname=current_user.nickname))
      elif request.method != "POST":
          form.date.data = datetime.date.today()
      else: return "didn't work" 
      return render_template('work_orders_add.html',
          user = ca[0],
          title = "New Work Order",
          form = form)
  else: return redirect(url_for('work_orders', nickname=current_user.nickname))
  </code></pre>
  
  <p>My <code>forms.py</code>:</p>
  
  <pre><code>class AddWorkOrderForm(Form)
      requestor = SelectField('requestor', coerce=unicode)
      date = DateField('date')
      notes = TextAreaField('notes')
      completed = BooleanField('completed', default = False)
  </code></pre>
  
  <p>My <code>models.py</code>:</p>
  
  <pre><code>class WorkOrder(db.Model):
      __tablename__ = 'workorder'
      id = db.Column(db.Integer, primary_key = True)
      date = db.Column(db.String(64))
      notes = db.Column(db.String(1024))
      total = db.Column(db.Float)
      completed = db.Column(db.Boolean)
      user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
      contact_id = db.Column(db.Integer, db.ForeignKey('contact.id'))
      items = db.relationship('WorkOrderItem', primaryjoin="WorkOrder.id==WorkOrderItem.work_order_id", backref = 'order')
  
      def __repr__(self):
          return '&lt;WorkOrder %r&gt;' % (self.id)
  </code></pre>
  
  <p>My HTML file:</p>
  
  <pre><code>{% extends "_is_logged.html" %}
  {% block content %}
  &lt;h1&gt;{{ title }}&lt;/h1&gt;
  &lt;form action="" method="post" name="work_order"&gt;
      {{ form.hidden_tag() }}
      &lt;p&gt;Requestor: {{ form.requestor() }}&lt;/p&gt;
      &lt;p&gt;Date: {{ form.date() }}&lt;/p&gt;
      &lt;p&gt;Notes: {{ form.notes(size=70) }}&lt;/p&gt;
      &lt;p&gt;Completed: {{ form.completed() }}&lt;/p&gt;
      &lt;p&gt;&lt;input type="submit" value="Add Work Order"&gt;&lt;/p&gt;
  &lt;/form&gt;
  {% endblock %}
  </code></pre>
  
  <p>Thanks.</p>