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.14.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b619abf58a677b37779a150cd5d48b201630c184051ea2b67019ba6fe70348d |
|
MD5 | fccab548055f9bde3307a7f2d8ca1c3d |
|
BLAKE2b-256 | 239c321df9e89c168026ccc0522053ea8da9e09272c1d8df06538da8554100dd |
Hashes for flask_download_btn-0.0.14-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46ddd6d4a92691db37ed2e07d9e63ac514a6e2ef7d1b9285c863a8be69c63a82 |
|
MD5 | f80c723e413945ae8256d6861c38b4ab |
|
BLAKE2b-256 | b55b06172bb97143c6bc336e6c4bcbad9bb39a4d3225fed09d14b682f746f845 |