I have a string field in my SQLAlchemy model and I would like to expose a select box with a few options in Flask-Admin instead of the standard text field.
class MyModel(db.Model):
id = db.Column(db.Integer, primary_key=True)
my_field = db.Column(db.String(128)) # Field I would like to be choices
class MyModelView(ModelView):
"""
Admin manager for MyModel
"""
# Which option should I use here?
def __init__(self):
super(MyModelView, self).__init__(MyModel, db.session)
UnboundField
is not callable exception related to Flask-Admin. It may be because you didn't do what this question suggests, defining solely the field class inform_overrides
and then configuring its instance with theform_args
entry. – Santanasantayana