title: Flask Mongoengine validation error with wtfform
body: <p>I've been working on WTF form with flask and mongoengine. When I try to register on html side as a new user this debug message appears.</p>
  
  <p><strong><em>ValidationError: ValidationError (User:None) (Field is required: ['password'] cannot parse date "asd": ['created_at'])</em></strong>
  <a href="https://i.stack.imgur.com/iavaU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iavaU.png" alt="enter image description here"></a></p>
  
  <p>I've basic django background. I am new to flask and I don't know how to figure it out.</p>
  
  <p><strong>Model:</strong></p>
  
  <pre><code>import datetime
  from copylighter import db, app
  from slugify import slugify
  from flask_login import UserMixin
  
      class User(db.Document, UserMixin):    
          created_at = db.DateTimeField(default=datetime.datetime.now)
          name = db.StringField(max_length=30, required=True, unique=True, help_text="Your helptext here")
          email = db.StringField(max_length=100, required=True, unique=True, help_text="Your helptext here")
          active = db.BooleanField()
          password = db.StringField(max_length=255, required=True, help_text="Your helptext here")
          slug = db.StringField(help_text="Your helptext here")
          roles = db.ListField(db.ReferenceField('Role'))
  
          def save(self, *args, **kwargs):
              if not self.slug:
                  self.slug = slugify(self.name)        
              return super(User, self).save(*args, **kwargs)
  
          def __unicode__(self):
              return self.name
  </code></pre>
  
  <p><strong>forms.py</strong></p>
  
  <pre><code>    from flask_wtf import Form
      from wtforms.fields import StringField, PasswordField, BooleanField, SubmitField, HiddenField
      from wtforms import validators
      from models import User
      import datetime 
  
      class SignUpForm(Form):
          created_at = HiddenField()
          name = StringField(u'Username', [validators.Required()])
          email = StringField(u'Email', [validators.Required()])
          password = PasswordField(u'Password', [validators.Required()])
          submit = SubmitField('Sign Up')
          class Meta():
              __model__ = 'User'
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code> from flask import Flask, render_template, redirect, url_for, request, flash
      from flask_login import login_required, login_user
      from copylighter import db, app, login_manager
      import datetime
      from forms import LoginForm,SignUpForm
      from slugify import slugify
      from flask_login import UserMixin
      from models import User
  
      @app.route("/register", methods=['GET','POST'])
      def register():
          formS = SignUpForm()
  
          #if formS.validate_on_submit():
              #name = formS.name.data
              #email = formS.email.data
              #password = formS.password.data
  
          if request.method == 'POST':
              formS = SignUpForm()
              formS.created_at.data = datetime.datetime.now()
  
              if formS.validate() == False:
                  return render_template('register.html', form=formS)
  
              if formS.validate_on_submit():
                  newuser = User(formS.name.data, formS.email.data, formS.password.data)              
                  newuser.save()
              return redirect(url_for('profile'))
  
          return render_template("register.html", form=formS)
  </code></pre>
  
  <p>and finally 
  <strong>register.html</strong></p>
  
  <pre><code>{% extends "base.html" %}
  
  {% block content %}
  
  &lt;div class="container"&gt; 
      &lt;form action="" method="post"&gt;                  
          {{form.hidden_tag()}}
          {{form.name.label}} 
          {{form.name}}
          {% if form.name.errors %} 
          &lt;span class="text-danger"&gt;Error&lt;/span&gt;
          {% endif %}
  
          {{form.email.label}} 
          {{form.email}}
          {% if form.email.errors %} 
          &lt;span class="text-danger"&gt;Error&lt;/span&gt;
          {% endif %}
  
          {{form.password.label}} 
          {{form.password}}
          {% if form.password.errors %} 
          &lt;span class="text-danger"&gt;Error&lt;/span&gt;
          {% endif %}
  
  
  
          {{ form.submit }}
  
  
  
      &lt;/form&gt; 
  
  &lt;/div&gt;
  
  {% endblock content %}
  </code></pre>
  
  <p>any help will be appreciated...</p>