Flask-Download-Btn defines a SQLALchemy Mixin for creating Bootstrap download buttons in a Flask application.
Project description
Flask-Download-Btn
Flask-Download-Btn defines a SQLALchemy Mixin for creating Bootstrap download buttons in a Flask application.
Its key features are:
- Automatic enabling and disabling: A download button is automatically disabled on click and re-enabling on download completion.
- Web form handling: Applications can modify a download button on click based on web form responses.
- Progress bar: Download buttons report progress using a progress bar updated with server-sent events.
Example: Basic use
Suppose we want to include a download button which downloads hello_world.txt
accessible at HELLO_WORLD_URL
. On click, we want to disable the button and re-enable it when the file finishes downloading.
After setup, we can achieve this with the following:
@app.route('/')
def index():
btn = DownloadBtn()
btn.text = 'Download'
btn.downloads = [(HELLO_WORLD_URL, 'hello_world')]
db.session.add(btn)
db.session.commit()
return render_template('index.html', download_btn=btn)
Documentation
You can find the latest documentation at https://dsbowen.github.io/flask-download-btn.
License
Publications which use this software should include the following citation for SQLAlchemy-Function and its dependencies, SQLAlchemy-Function and SQLAlchemy-Mutable:
Bowen, D.S. (2019). Flask-Download-Btn[Computer software]. https://dsbowen.github.io/flask-download-btn.
Bowen, D.S. (2019). SQLAlchemy-Function [Computer software]. https://dsbowen.github.io/sqlalchemy-function.
Bowen, D.S. (2019). SQLAlchemy-Mutable [Computer software]. https://dsbowen.github.io/sqlalchemy-mutable.
This project is licensed under the MIT License LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for flask-download-btn-0.0.12.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 725370ad75df0dd8fae5073a9229ec138e38d9256db63594fac345825b52bc3b |
|
MD5 | 5e92b4a0ed9764a6d500fa722ee461e2 |
|
BLAKE2b-256 | aa56dca1b8d47f181b48269155677d3ba12d189fc75de32dc122f2dcf7e230b0 |
Hashes for flask_download_btn-0.0.12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd3d6e7a833283e334ac62676d28dab9028dc53ed85d51c658e6298aec4f8741 |
|
MD5 | cb56589ccb5fb012104c436e564cc4d2 |
|
BLAKE2b-256 | ca9b6b425d5bdb3712d702e7e5c82e9b62a3061b630745eb29e0f3cba6339335 |