title: DateForm Python-Flask - [u'Not a valid date value']}
body: <p>I'm developing a WEB APP and at some point I want to create a new entry to my Politic table. I could do it until I had to add some dates. The form isnt accepting the input due to a wrong date format. Lets look into it..</p>
  
  <p>I have this form:</p>
  
  <pre><code>class PoliticForm(FlaskForm):
    publicName = StringField('Public Name', validators=[DataRequired("Please enter politician public name.")])
    completeName = StringField('Complete Name', validators=[DataRequired("Please enter politician complete name.")])
    startDate = DateField('Start Date', format='%m-%d-%Y', validators=[DataRequired("Please enter the politician start Date.")])
    endDate = DateField('End Date', format='%m-%d-%Y', validators=(validators.Optional(),))
    submit = SubmitField('Add Politician', validators=(validators.Optional(),))
  </code></pre>
  
  <p>but somehow the datefield isnt right because my form can't validate the <strong>startDate</strong> field nor the <strong>endDate</strong> field. 
  This is my create function:</p>
  
  <pre><code>@app.route("/create_politician", methods=["GET", "POST"])
  @login_required
  def create_politician():
    form = PoliticForm()
  
    if request.method == "POST":
      print form.validate()
      flash(form.errors)
      if form.validate() == False:
        return render_template('createPolitician.html', form=form)
      else:
        print form.startDate.data
        newpolitician = Politic(form.publicName.data, form.completeName.data, form.startDate.data, form.endDate.data)
        print form.startDate.data
        db.session.add(newpolitician)
        db.session.commit()
        return redirect(url_for('home'))
  
    elif request.method == "GET":
      return render_template("createPolitician.html", form=form)
  </code></pre>
  
  <p>and on that        <strong>flash(form.errors)</strong><br>
  I get the following:</p>
  
  <blockquote>
    <p>{'startDate': ['Please enter the politician start Date.'], 'endDate': [u'Not a valid date value']}</p>
  </blockquote>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>class Politic(db.Model):
    __searchable__ = ['publicName', 'completeName']
    __tablename__ = 'politics'
  
    idPolitician = db.Column(db.Integer, primary_key=True)
    publicName = db.Column(db.String(150))
    completeName = db.Column(db.String(300))
    startDate = db.Column(db.Date)
    endDate = db.Column(db.Date)
  
    def __init__(self, publicName, completeName, startDate, endDate):
      self.publicName = publicName.title()
      self.completeName = completeName.title()
  </code></pre>
  
  <p><strong>.html</strong></p>
  
  <pre><code>&lt;form method="POST" action="/create_politician"&gt;
          {{ form.hidden_tag() }}
  
          &lt;div class="form-group"&gt;
            {{ form.publicName.label }}
            {{ form.publicName }}
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
            {{ form.completeName.label }}
            {{ form.completeName }}
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
            {{ form.startDate.label }}
            {{ form.startDate }}
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
            {{ form.endDate.label }}
            {{ form.endDate }}
          &lt;/div&gt;
  
          {{ form.submit(class="btn-primary") }}
  
        &lt;/form&gt;
  </code></pre>
  
  <p>Any idea, what is wrong. Is there any way to format the date input in order to match what the form is asking for?</p>
  
  <p>Thank you</p>
  
  <p>Regards</p>