How can I customize field names in create/edit forms in Flask-Admin?
I know how to change the table name:
class User(db.Model):
__tablename__ = 'user'
id = db.Column('user_id', db.Integer, primary_key=True, autoincrement=True)
first_name = db.Column(db.String(100))
last_name = db.Column(db.String(100))
login = db.Column(db.String(80), unique=True, nullable=False)
email = db.Column(db.String(120))
password = db.Column(db.String(128))
from flask.ext.admin.contrib.sqla import ModelView
class MyModelView(ModelView):
def is_accessible(self):
return current_user.is_authenticated()
admin = Admin(app, u'CustomName')
admin.add_view(MyModelView(User, db.session, u'Custom Table Name'))
In create/edit forms I get field name like name of columns in User db.Model.
How I can simply change this field name?
For example, to get 'Foo' instead of 'login' in create form for a User?