Modify input field sizes in Flask-Admin

女生的网名这么多〃 提交于 2019-12-25 03:00:32

问题


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?


回答1:


Use form_widget_args.

For example:

class MyModelView(BaseModelView):
    form_widget_args = {
        'description': {
            'rows': 10,
            'class': 'input-xlarge'
        }
    }



回答2:


Somewhat dirty way, but still useful

class MyModelView(BaseModelView):    
    form_widget_args = {
        'description': {
            'rows': 20,
            'style':'width: 1000px;'
        }
    }


来源:https://stackoverflow.com/questions/23249100/modify-input-field-sizes-in-flask-admin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!