serve file from the download form
This commit is contained in:
parent
e340e967a6
commit
64772b13ba
3 changed files with 10 additions and 12 deletions
|
@ -12,11 +12,11 @@ def index():
|
|||
def download():
|
||||
form = DownloadForm()
|
||||
if form.validate_on_submit():
|
||||
return render_template('download_thanks.html', title='Download', form=form)
|
||||
return render_template('download.html', form=form, filename='test.mp3')
|
||||
elif request.method == 'GET':
|
||||
form.date.data = datetime.now() - timedelta(hours = 1)
|
||||
form.length.data = 60
|
||||
return render_template('download.html', title='Download', form=form)
|
||||
return render_template('download.html', form=form)
|
||||
|
||||
@app.route('/download_file/<path:filename>')
|
||||
def download_file(filename):
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
{% if filename is defined %}
|
||||
<meta http-equiv="refresh" content="0;URL='download_file/{{ filename }}'" />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block app_content %}
|
||||
<h1>Download</h1>
|
||||
<form action="" method="post" novalidate>
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
<meta http-equiv="refresh" content="0;URL='download_file/test.mp3'" />
|
||||
{% endblock %}
|
||||
|
||||
{% block app_content %}
|
||||
<h1>Thanks!</h1>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue