title: defining a mongoengine model with ListField that cannot be empty
body: <p>I am using flask-mongoengine and my model <code>Post</code> has fields <code>title</code>, <code>slug</code>, <code>body</code> and <code>tags</code>. Each <code>Post</code> has a unique <code>slug</code> and each <code>Post</code> needs to have at least 1 tag. So <code>tags</code> is a <code>list</code> of <code>strings</code> with at least 1 element.</p>
  
  <pre><code>class Post(db.Document):
      created_at = db.DateTimeField(default=datetime.datetime.now, required=True)
      title = db.StringField(max_length=255, required=True)
      slug = db.StringField(max_length=255, required=True, unique=True)
      body = db.StringField(required=True)
      tags = db.ListField(db.StringField(max_length=255), required=True)   #each post should have at least one tag
  
      def get_absolute_url(self):
          return url_for('post', kwargs={"slug": self.slug})
  
      def __unicode__(self):
          return self.title
  
      meta = {
          'allow_inheritance': False,
          'indexes': ['-created_at', 'slug', 'title', 'tags'],
          'ordering': ['-created_at'],
          'collection': 'posts',
      }
  </code></pre>
  
  <p>when i create a form in the template for entering a new post, each tag is entered in a new text box with name <code>tags</code> so if i have 3 tags for a <code>Post</code> then there would be 3 text boxes with each having name <code>tags</code>
  Here is how the view is </p>
  
  <pre><code>from flask.ext.mongoengine.wtf import model_form
  class CreateEdit(MethodView):
  
      form = model_form(Post)    #Gets object of class PostForm which is a subclass of ModelForm, ModelForm is a subclass of Form
      def post(self, slug = None):
          form = self.form(request.form)   #Populate PostForm with data from the request
          post = Post()
          form.populate_obj(post)
          post.save()
          flash('Update successful')
  </code></pre>
  
  <p>Now i get a <code>mongoengine.base.ValidationError</code> error in the browser. 
  The data that i pass in the post request (Courtesy: Firebug)</p>
  
  <pre><code>title: third post
  slug: 3rd
  body: this is the 3rd post
  tags: third
  tags: last
  </code></pre>
  
  <p>When i inspected in the debugger <code>request.form</code> shows </p>
  
  <pre><code>werkzeug.datastructures.ImmutableMultiDict({'body': u'this is the 3rd post    \r\n  ', 'title': u'third post', 'slug': u'3rd', 'tags': u'third'})
  </code></pre>
  
  <p>now there are multiple <code>tags</code> in the form but only one is present in the dictionary. This is OK because its a dictionary so there cant be multiple keys with same name. But when i inspect <code>form.data</code> it shows </p>
  
  <pre><code>{'body': u'this is the 3rd post    \r\n  ', 'title': u'third post', 'created_at': datetime.datetime(2012, 12, 24, 14, 7, 18, 97273), 'tags': [], 'slug': u'3rd'  }
  </code></pre>
  
  <p>the <code>tags</code> field is an empty list which is absurd because it should be populated with <code>tags</code> from <code>request.form</code>. Also if i enter <code>print request.form</code> in the debugger i get </p>
  
  <pre><code>ImmutableMultiDict([('body', u'this is the 3rd post    \r\n  '), ('title', u'third post'), ('slug', u'3rd'), ('tags', u'third'), ('tags', u'last')])
  </code></pre>
  
  <p>So it means the <code>request</code> object retains multiple values for the same name to show it in the representation(<code>__repr__</code>) but passes only one value to the <code>ModelForm</code> object. But my <code>ModelForm</code> is not getting any value for <code>tags</code>.</p>
  
  <p>Whats wrong?</p>