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 = get_btn('basic')
if not btn:
btn = DownloadBtn()
btn.downloads = [(HELLO_WORLD_URL, 'hello_world.txt')]
add_to_session(btn, 'basic')
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, SQLAlchemy-Mutable, and SQLAlchemy-MutableSoup:
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.
Bowen, D.S. (2020). SQLAlchemy-MutableSoup [Computer software]. https://dsbowen.github.io/sqlalchemy-mutablesoup.
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.17.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e45fe4373d5bca4fab6d1a0ae48a90d028829b9abefaf68139fd83901c7e7b6e |
|
MD5 | 69543710b3bd9be6e3b5dc53e063c568 |
|
BLAKE2b-256 | 8c95c6b3b2b2c467c5724f5929c25d6da2f6ab2eda5c10bfaa84335e22da08fe |
Hashes for flask_download_btn-0.0.17-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 148ebe49e4f57593f646e24cca949ef18ebc8ba9b8e373374bcbf6386b23e46f |
|
MD5 | 7595ff3381cc94a17bd294ebf9b4b4b7 |
|
BLAKE2b-256 | e3431506ed3d74ef81f5ff376ce014e503bd2ccf08502c0b885465d6cc374b5c |