flask-mongoengine
flask-mongoengine copied to clipboard
model_form fails for ListField of EmbeddedDocumentField declared using a string
This is probably related to #23. If the model contains a ListField
wrapping an EmbeddedDocumentField
and the latter is built from a string, then model_form
fails.
The following code shows the problem
from flask.ext.mongoengine import MongoEngine
from flask.ext.mongoengine.wtf import model_form
db = MongoEngine()
class EmbedMe( db.EmbeddedDocument ):
afield = db.StringField()
class Outer( db.Document ):
embedded = db.ListField( db.EmbeddedDocumentField( EmbedMe ) )
class OuterString( db.Document ):
embedded = db.ListField( db.EmbeddedDocumentField( 'EmbedMe' ) )
print model_form( Outer )
print model_form( OuterString )
I'm sure I can provide a failing test based on aa6f13ccffee6aa29a72c3fc0278fe83d66f4981 and the snippet above, but I'm not sure I can also provide a fix.
Dear @rozza, can you help?
:+1: I am also having that issue
I'm sure I can provide a failing test based on aa6f13c and the snippet above, but I'm not sure I can also provide a fix.
Failing test would be a good start. Thanks.