Skip to content Skip to sidebar Skip to footer

Modify Input Field Sizes In Flask-admin

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

Solution 1:

Use form_widget_args.

For example:

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

Solution 2:

Somewhat dirty way, but still useful

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

Post a Comment for "Modify Input Field Sizes In Flask-admin"