Modify input field sizes in Flask-Admin

2019-08-31 14:36发布

Does anyone know of an easy way to specify a size for input fields in Flask-Admin?

E.g. setting class="input-xlarge" on an input field does the trick, but is there a simple way to do that from Flask-Admin?

2条回答
走好不送
2楼-- · 2019-08-31 15:02

Somewhat dirty way, but still useful

class MyModelView(BaseModelView):    
    form_widget_args = {
        'description': {
            'rows': 20,
            'style':'width: 1000px;'
        }
    }
查看更多
冷血范
3楼-- · 2019-08-31 15:06

Use form_widget_args.

For example:

class MyModelView(BaseModelView):
    form_widget_args = {
        'description': {
            'rows': 10,
            'class': 'input-xlarge'
        }
    }
查看更多
登录 后发表回答