def test_nested_subdocument_config():
    (app, db, admin) = setup()

    class Comment(db.EmbeddedDocument):
        name = db.StringField(max_length=20, required=True)
        value = db.StringField(max_length=20)

    class Nested(db.EmbeddedDocument):
        name = db.StringField(max_length=20, required=True)
        comment = db.EmbeddedDocumentField(Comment)

    class Model1(db.Document):
        test1 = db.StringField(max_length=20)
        nested = db.EmbeddedDocumentField(Nested)
    view1 = CustomModelView(Model1, form_subdocuments={'nested': {'form_subdocuments': {'comment': {'form_columns': ('name',)}}}})
    form = view1.create_form()
    ok_(('name' in dir(form.nested.form.comment.form)))
    ok_(('value' not in dir(form.nested.form.comment.form)))
def test_nested_subdocument_config():
    (app, db, admin) = setup()

    class Comment(db.EmbeddedDocument):
        name = db.StringField(max_length=20, required=True)
        value = db.StringField(max_length=20)

    class Nested(db.EmbeddedDocument):
        name = db.StringField(max_length=20, required=True)
        comment = db.EmbeddedDocumentField(Comment)

    class Model1(db.Document):
        test1 = db.StringField(max_length=20)
        nested = db.EmbeddedDocumentField(Nested)
    view1 = CustomModelView(Model1, form_subdocuments={'nested': {'form_subdocuments': {'comment': {'form_columns': ('name',)}}}})
    form = view1.create_form()
    ok_(('name' in dir(form.nested.form.comment.form)))
    ok_(('value' not in dir(form.nested.form.comment.form)))