How to disable field in MongoEngine subdocument in Flask-Admin
In the documentation there is an information about form_widget_args and form_subdocuments attributes of ModelView
class. To do this task they can be used together:
class MyEmbeddedDoc(DynamicEmbeddedDocument):
created = DateTimeField(default=datetime.utcnow)
class MyDoc(DynamicDocument):
data = EmbeddedDocumentField(MyEmbeddedDoc)
class MyDocView(ModelView):
form_subdocuments = {
'data': {
'form_widget_args': {
'created': {'disabled': True}
}
}
}