EspenG EspenG - 5 months ago 75x
Python Question

Flask-security and Bootstrap

How can I style my Flask-security login site with Bootstrap? The html form looks like this:

<form action="{{ url_for_security('login') }}" method="POST" name="login_form">
{{ login_user_form.hidden_tag() }}
{{ render_field_with_errors( }}
{{ render_field_with_errors(login_user_form.password) }}
{{ render_field_with_errors(login_user_form.remember) }}
{{ render_field( }}
{{ render_field(login_user_form.submit) }}

Bootstrap is implemented, but I dont know how to edit the fields and the submit button..


The render_field_* functions accepts a class_ parameter, which will add HTML classes to the field. Add in bootstrap styling classes as you want.

render_field_with_errors(, class_="form-control") }}
{{ render_field(login_user_form.submit, class_="btn btn-default") }}

And so on.