python - Flask 安全和 Bootstrap

标签 python twitter-bootstrap flask flask-login flask-security

如何使用 Bootstrap 设置我的 Flask 安全登录站点的样式? html 表单如下所示:

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

Bootstrap 已实现,但我不知道如何编辑字段和提交按钮..

最佳答案

render_field_* 函数接受一个 class_ 参数,它将 HTML 类添加到该字段。根据需要添加 Bootstrap 样式类。

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

等等。

关于python - Flask 安全和 Bootstrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34659619/

相关文章:

php - 爆炸的病态正则表达式(时间和内存)?

knockout.js - 如何使用 Bootstrap 样式的挖空循环遍历 Twig 中的数据?

css - 仅在悬停时突出显示单元格

jquery - 如何在bootstrap中添加动态div?

caching - 服务器正在提供旧版本的静态文件,但经过修剪或填充以匹配新版本的长度

Flask-Migrate `db upgrade` 失败, "relation does not exist"

docker - 如何在生产中在容器内提供 Flask

python - 在 Python 中使用 python-memcache (memcached) 的好例子?

python - 连接包含列表的两列python

python - 有没有办法检查网站使用的身份验证类型?