Reputation: 316
I have following mongoengine model:
class User(db.Document):
name = db.StringField(max_length=100)
email = db.StringField(max_length=100)
and following Flask-Admin ModelView
class UserView(ModelView):
column_labels = {'name': 'MyName', email: 'MyEmail'}
This works while list page and detail page but doesn't work for 'create form' and 'edit form'. Which means form field label's text still does not change.
This is a simplified question of my real case problem. I know that we can manipulate this fields in create_form and update_form methods. However, I really don't know what to do when we have EmbeddedDocument and some relations like in the following scenario:
class User(db.Document):
name = db.StringField(max_length=100)
email = db.StringField(max_length=100)
employee = db.EmbeddedDocumentField(Employee)
class Employee(db.EmbeddedDocument):
job = db.StringField(max_length=100)
purpose = db.StringField(max_length=100)
time_for_looking_job = db.StringField(max_length=100)
education_information = db.ListField(db.EmbeddedDocumentField(EducationInformation))
class EducationInformation(db.EmbeddedDocument):
education_degree = db.StringField(max_length=100)
school_name = db.StringField(max_length=100)
Thanks for your helps...
Upvotes: 2
Views: 234
Reputation: 1
I seen issue like urs with mongoengine, i found partial solution:
form_args = dict(
name=dict(label='MyName')
email=dict(email='MyEmail')
)
Upvotes: 0