flask-mongoengine icon indicating copy to clipboard operation
flask-mongoengine copied to clipboard

model_form fails for ListField of EmbeddedDocumentField declared using a string

Open mapio opened this issue 11 years ago • 2 comments

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?

mapio avatar Jun 27 '13 00:06 mapio

:+1: I am also having that issue

rochacbruno avatar Nov 06 '13 17:11 rochacbruno

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.

lafrech avatar Feb 23 '16 13:02 lafrech