Marat Khabibullin  committed 58e1c1b

fix field generation for embeddeddocument

  • Participants
  • Parent commits 620ef82
  • Branches default

Comments (0)

Files changed (2)

File wtforms/ext/mongoengine/

 #Author: Marat Khabibullin <>
 from wtforms.form import Form
 from document_update import Document
+from mongoengine.base import BaseDocument
 class ModelForm(Form):
     model_class = None
                            self.model_class or \
                            self.instance and self.instance.__class__
-        assert issubclass(self.model_class, Document), 'ModelForm model_class attribute must be subclass of Document'
+        assert issubclass(self.model_class, BaseDocument), 'ModelForm model_class attribute must be subclass of BaseDocument'
         assert self.instance is None or isinstance(self.instance, self.model_class), 'ModelForm instance attribute must be instance of model_class'
         super(ModelForm, self).__init__(*args, **kwargs)

File wtforms/ext/mongoengine/

             'validators': [],
             'filters': [],
-        form_class = model_form(field.document, field_args={})
+        form_class = model_form(field.document_type_obj, field_args={})
         return f.FormField(form_class, **kwargs)