# Flask-Download-Btn
Flask-Download-Btn defines a [SQLALchemy Mixin](https://docs.sqlalchemy.org/en/13/orm/extensions/declarative/mixins.html) for creating [Bootstrap](https://getbootstrap.com/) download buttons in a [Flask](https://palletsprojects.com/p/flask/) application.
Its key features are:
1. *Automatic enabling and disabling*: A download button is automatically disabled on click and re-enabling on download completion.
2. *Web form handling*: Applications can modify a download button on click based on web form responses.
3. *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:
```python
@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](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](https://dsbowen.github.io/sqlalchemy-function) and [SQLAlchemy-Mutable](https://dsbowen.github.io/sqlalchemy-mutable):
Bowen, D.S. (2019). Flask-Download-Btn\[Computer software\]. [https://dsbowen.github.io/flask-download-btn](https://dsbowen.github.io/flask-download-btn).
Bowen, D.S. (2019). SQLAlchemy-Function \[Computer software\]. [https://dsbowen.github.io/sqlalchemy-function](https://dsbowen.github.io/sqlalchemy-function).
Bowen, D.S. (2019). SQLAlchemy-Mutable \[Computer software\]. [https://dsbowen.github.io/sqlalchemy-mutable](https://dsbowen.github.io/sqlalchemy-mutable).
This project is licensed under the MIT License [LICENSE](https://github.com/dsbowen/flask-download-btn/blob/master/LICENSE).
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共14个文件
txt:3个
html:3个
py:3个
资源分类:Python库 所属语言:Python 资源全名:flask-download-btn-0.0.16.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
flask-download-btn-0.0.16.tar.gz (14个子文件)
flask-download-btn-0.0.16
MANIFEST.in 57B
PKG-INFO 3KB
setup.cfg 38B
flask_download_btn.egg-info
PKG-INFO 3KB
SOURCES.txt 434B
top_level.txt 19B
dependency_links.txt 1B
setup.py 778B
README.md 2KB
flask_download_btn
download_btn_mixin.py 10KB
templates
download_btn
progress.html 478B
script.html 4KB
button.html 97B
__init__.py 3KB
共 14 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功