Skip to content

only= does not work if model_form is EmbeddedDocument #376

Open
@Alexmod

Description

@Alexmod

Example:

class Profile(db.EmbeddedDocument):     
    login = db.StringField()            
    pw_hash = db.StringField()    
    admin = db.BooleanField()     

                                                                                       
class Users(db.Document):      
    _id = db.ObjectIdField()
    stocks = db.DictField() 
    profile = db.EmbeddedDocumentField(Profile) 

If I use exclude like this, then everything is OK:

from flask_mongoengine.wtf import model_form 

form = model_form(Users, exclude=('profile__login'))(request.form)

And the form is generated without the field login.

But if I do like this:

form = model_form(Users, only=('profile__login'))(request.form)

Then nothing is generated.
I use flask-mongoengine Version 0.9.5

P.S.: Thanks to maintainers who support this project.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions