Name | Bootstrap-Flask JSON |
Version |
2.4.1
JSON |
| download |
home_page | None |
Summary | Bootstrap 4 & 5 helper for your Flask projects. |
upload_time | 2024-10-03 15:08:12 |
maintainer | None |
docs_url | None |
author | None |
requires_python | None |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Bootstrap-Flask
![PyPI - License](https://img.shields.io/pypi/l/bootstrap-flask)
[![Current version on PyPI](https://img.shields.io/pypi/v/bootstrap-flask)](https://pypi.org/project/bootstrap-flask/)
[![Build status](https://github.com/helloflask/bootstrap-flask/workflows/build/badge.svg)](https://github.com/helloflask/bootstrap-flask/actions)
[![Coverage Status](https://coveralls.io/repos/github/helloflask/bootstrap-flask/badge.svg?branch=main)](https://coveralls.io/github/helloflask/bootstrap-flask?branch=main)
[![Open Collective](https://img.shields.io/opencollective/all/bootstrap-flask)](https://opencollective.com/bootstrap-flask)
Bootstrap-Flask is a collection of Jinja macros for Bootstrap 4 & 5 and Flask. It helps you to
render Flask-related data and objects to Bootstrap markup HTML more easily:
- Render Flask-WTF/WTForms form object to Bootstrap Form.
- Render data objects (dict or class objects) to Bootstrap Table.
- Render Flask-SQLAlchemy `Pagination` object to Bootstrap Pagination.
- etc.
## Installation
```
$ pip install -U bootstrap-flask
```
## Example
Register the extension:
```python
from flask import Flask
# To follow the naming rule of Flask extension, although
# this project's name is Bootstrap-Flask, the actual package
# installed is named `flask_bootstrap`.
from flask_bootstrap import Bootstrap5
app = Flask(__name__)
bootstrap = Bootstrap5(app)
```
Assuming you have a Flask-WTF form like this:
```python
class LoginForm(FlaskForm):
username = StringField('Username', validators=[DataRequired(), Length(1, 20)])
password = PasswordField('Password', validators=[DataRequired(), Length(8, 150)])
remember = BooleanField('Remember me')
submit = SubmitField()
```
Now with the `render_form` macro:
```html
{% from 'bootstrap5/form.html' import render_form %}
<html>
<head>
<!-- Bootstrap CSS -->
</head>
<body>
<h2>Login</h2>
{{ render_form(form) }}
<!-- Bootstrap JS -->
</body>
</html>
```
You will get a form like this with only one line code (i.e. `{{ render_form(form) }}`):
![form rendering](./docs/_static/form-example.png)
When the validation fails, the error messages will be rendered with proper style:
![error form rendering](./docs/_static/error-form-example.png)
Read the [Basic Usage](https://bootstrap-flask.readthedocs.io/en/stable/basic)
docs for more details.
## Live demo
https://bootstrap-flask-example.azurewebsites.net/
## Donate
If you find Bootstrap-Flask useful, please consider
[donating today](https://opencollective.com/bootstrap-flask/donate). Your donation keeps
Bootstrap-Flask maintained and updated with Bootstrap.
## Links
- [Documentation](https://bootstrap-flask.readthedocs.io)
- [Example Application](https://github.com/helloflask/bootstrap-flask/tree/main/examples)
- [PyPI Releases](https://pypi.org/project/Bootstrap-Flask/)
- [Changelog](https://github.com/helloflask/bootstrap-flask/blob/main/CHANGES.rst)
- [Discussions](https://github.com/helloflask/bootstrap-flask/discussions)
## Notes for Bootstrap 4 & 5 support
The Bootstrap 5 support is added in Bootstrap-Flask 2.0 version. Now you can use
the separate extension class for different Bootstrap major versions.
For Bootstrap 4, use the `Bootstrap4` class:
```python
from flask_bootstrap import Bootstrap4
# ...
bootstrap = Bootstrap4(app)
```
and import macros from the template path `bootstrap4/`:
```html
{% from 'bootstrap4/form.html' import render_form %}
```
For Bootstrap 5, use the `Bootstrap5` class:
```python
from flask_bootstrap import Bootstrap5
# ...
bootstrap = Bootstrap5(app)
```
and import macros from the template path `bootstrap5/`:
```html
{% from 'bootstrap5/form.html' import render_form %}
```
The `Bootstrap` class and `bootstrap/` template path are deprecated since 2.0
and will be removed in 3.0.
## Migration from Flask-Bootstrap
If you come from Flask-Bootstrap, check out
[this tutorial](https://bootstrap-flask.readthedocs.io/en/stable/migrate/) on how to
migrate to this extension.
## Contributing
For guidance on setting up a development environment and how to make a
contribution to Bootstrap-Flask, see the
[development documentation](https://bootstrap-flask.readthedocs.io/en/stable/#development)
and Flask's
[contributing guidelines](https://github.com/pallets/flask/blob/main/CONTRIBUTING.rst).
## License
This project is licensed under the MIT License (see the `LICENSE` file for
details). Some macros were part of Flask-Bootstrap and were modified under
the terms of its BSD License.
Raw data
{
"_id": null,
"home_page": null,
"name": "Bootstrap-Flask",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Grey Li <withlihui@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/9f/9d/10ee6ee17ee1da2d49c752c6dbabdc45be66f9b6c60b0b3feb2c2733245d/bootstrap_flask-2.4.1.tar.gz",
"platform": null,
"description": "# Bootstrap-Flask\n\n![PyPI - License](https://img.shields.io/pypi/l/bootstrap-flask)\n[![Current version on PyPI](https://img.shields.io/pypi/v/bootstrap-flask)](https://pypi.org/project/bootstrap-flask/)\n[![Build status](https://github.com/helloflask/bootstrap-flask/workflows/build/badge.svg)](https://github.com/helloflask/bootstrap-flask/actions)\n[![Coverage Status](https://coveralls.io/repos/github/helloflask/bootstrap-flask/badge.svg?branch=main)](https://coveralls.io/github/helloflask/bootstrap-flask?branch=main)\n[![Open Collective](https://img.shields.io/opencollective/all/bootstrap-flask)](https://opencollective.com/bootstrap-flask)\n\nBootstrap-Flask is a collection of Jinja macros for Bootstrap 4 & 5 and Flask. It helps you to\nrender Flask-related data and objects to Bootstrap markup HTML more easily:\n\n- Render Flask-WTF/WTForms form object to Bootstrap Form.\n- Render data objects (dict or class objects) to Bootstrap Table.\n- Render Flask-SQLAlchemy `Pagination` object to Bootstrap Pagination.\n- etc.\n\n\n## Installation\n\n```\n$ pip install -U bootstrap-flask\n```\n\n## Example\n\nRegister the extension:\n\n```python\nfrom flask import Flask\n# To follow the naming rule of Flask extension, although\n# this project's name is Bootstrap-Flask, the actual package\n# installed is named `flask_bootstrap`.\nfrom flask_bootstrap import Bootstrap5\n\napp = Flask(__name__)\nbootstrap = Bootstrap5(app)\n```\n\nAssuming you have a Flask-WTF form like this:\n\n```python\nclass LoginForm(FlaskForm):\n username = StringField('Username', validators=[DataRequired(), Length(1, 20)])\n password = PasswordField('Password', validators=[DataRequired(), Length(8, 150)])\n remember = BooleanField('Remember me')\n submit = SubmitField()\n```\n\nNow with the `render_form` macro:\n\n```html\n{% from 'bootstrap5/form.html' import render_form %}\n<html>\n<head>\n<!-- Bootstrap CSS -->\n</head>\n<body>\n\n<h2>Login</h2>\n{{ render_form(form) }}\n\n<!-- Bootstrap JS -->\n</body>\n</html>\n```\n\nYou will get a form like this with only one line code (i.e. `{{ render_form(form) }}`):\n\n![form rendering](./docs/_static/form-example.png)\n\nWhen the validation fails, the error messages will be rendered with proper style:\n\n![error form rendering](./docs/_static/error-form-example.png)\n\nRead the [Basic Usage](https://bootstrap-flask.readthedocs.io/en/stable/basic) \ndocs for more details.\n\n\n## Live demo\n\nhttps://bootstrap-flask-example.azurewebsites.net/\n\n\n## Donate\n\nIf you find Bootstrap-Flask useful, please consider\n[donating today](https://opencollective.com/bootstrap-flask/donate). Your donation keeps\nBootstrap-Flask maintained and updated with Bootstrap.\n\n\n## Links\n\n- [Documentation](https://bootstrap-flask.readthedocs.io)\n- [Example Application](https://github.com/helloflask/bootstrap-flask/tree/main/examples)\n- [PyPI Releases](https://pypi.org/project/Bootstrap-Flask/)\n- [Changelog](https://github.com/helloflask/bootstrap-flask/blob/main/CHANGES.rst)\n- [Discussions](https://github.com/helloflask/bootstrap-flask/discussions)\n\n\n## Notes for Bootstrap 4 & 5 support\n\nThe Bootstrap 5 support is added in Bootstrap-Flask 2.0 version. Now you can use\nthe separate extension class for different Bootstrap major versions.\n\nFor Bootstrap 4, use the `Bootstrap4` class:\n\n```python\nfrom flask_bootstrap import Bootstrap4\n\n# ...\nbootstrap = Bootstrap4(app)\n```\n\nand import macros from the template path `bootstrap4/`:\n\n```html\n{% from 'bootstrap4/form.html' import render_form %}\n```\n\nFor Bootstrap 5, use the `Bootstrap5` class:\n\n```python\nfrom flask_bootstrap import Bootstrap5\n\n# ...\nbootstrap = Bootstrap5(app)\n```\n\nand import macros from the template path `bootstrap5/`:\n\n```html\n{% from 'bootstrap5/form.html' import render_form %}\n```\n\nThe `Bootstrap` class and `bootstrap/` template path are deprecated since 2.0\nand will be removed in 3.0.\n\n\n## Migration from Flask-Bootstrap\n\nIf you come from Flask-Bootstrap, check out\n[this tutorial](https://bootstrap-flask.readthedocs.io/en/stable/migrate/) on how to\nmigrate to this extension.\n\n\n## Contributing\n\nFor guidance on setting up a development environment and how to make a\ncontribution to Bootstrap-Flask, see the\n[development documentation](https://bootstrap-flask.readthedocs.io/en/stable/#development)\nand Flask's\n[contributing guidelines](https://github.com/pallets/flask/blob/main/CONTRIBUTING.rst).\n\n\n## License\n\nThis project is licensed under the MIT License (see the `LICENSE` file for\ndetails). Some macros were part of Flask-Bootstrap and were modified under\nthe terms of its BSD License.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Bootstrap 4 & 5 helper for your Flask projects.",
"version": "2.4.1",
"project_urls": {
"Changes": "https://bootstrap-flask.readthedocs.io/en/stable/changelog/",
"Discussions": "https://github.com/helloflask/bootstrap-flask/discussions/",
"Documentation": "https://bootstrap-flask.readthedocs.io/en/stable/",
"Funding": "https://opencollective.com/bootstrap-flask",
"Issue Tracker": "https://github.com/helloflask/bootstrap-flask/issues/",
"Source Code": "https://github.com/helloflask/bootstrap-flask/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7ecbf8b2487ffaee50016293fe364bb6693776fae846bff69cbc41371e475a07",
"md5": "344873310cc0deba029d5f8cbcacfa7e",
"sha256": "222df5b42c7795b121ed4709c534466c892e04ee31bfac7234de3ea64c106c27"
},
"downloads": -1,
"filename": "Bootstrap_Flask-2.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "344873310cc0deba029d5f8cbcacfa7e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3944263,
"upload_time": "2024-10-03T15:08:09",
"upload_time_iso_8601": "2024-10-03T15:08:09.640073Z",
"url": "https://files.pythonhosted.org/packages/7e/cb/f8b2487ffaee50016293fe364bb6693776fae846bff69cbc41371e475a07/Bootstrap_Flask-2.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9f9d10ee6ee17ee1da2d49c752c6dbabdc45be66f9b6c60b0b3feb2c2733245d",
"md5": "508cd90cf14581cacc239105551036cc",
"sha256": "cc25c59495f150550ea41d0e8079689de4250fe45445e158abdc111f8fe883e2"
},
"downloads": -1,
"filename": "bootstrap_flask-2.4.1.tar.gz",
"has_sig": false,
"md5_digest": "508cd90cf14581cacc239105551036cc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3841144,
"upload_time": "2024-10-03T15:08:12",
"upload_time_iso_8601": "2024-10-03T15:08:12.075020Z",
"url": "https://files.pythonhosted.org/packages/9f/9d/10ee6ee17ee1da2d49c752c6dbabdc45be66f9b6c60b0b3feb2c2733245d/bootstrap_flask-2.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-03 15:08:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "helloflask",
"github_project": "bootstrap-flask",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "bootstrap-flask"
}