rename date to start time

stable
neingeist 6 years ago
parent 3f82634c30
commit d1703c8952

@ -3,6 +3,6 @@ from wtforms import DateTimeField, DecimalField, SubmitField
from wtforms.validators import DataRequired from wtforms.validators import DataRequired
class DownloadForm(FlaskForm): class DownloadForm(FlaskForm):
date = DateTimeField('Date', validators=[DataRequired()]) start_time = DateTimeField('Start time', validators=[DataRequired()])
length = DecimalField('Length', validators=[DataRequired()]) length = DecimalField('Length', validators=[DataRequired()])
submit = SubmitField('Download') submit = SubmitField('Download')

@ -7,7 +7,7 @@ from datetime import datetime, timedelta
def download(): def download():
form = DownloadForm() form = DownloadForm()
if request.method == 'GET': if request.method == 'GET':
form.date.data = datetime.now() - timedelta(hours = 1) form.start_time.data = datetime.now() - timedelta(hours = 1)
form.length.data = 60 form.length.data = 60
elif form.validate_on_submit(): elif form.validate_on_submit():
flash('The download should start immediately.') flash('The download should start immediately.')

@ -13,9 +13,9 @@
<form action="" method="post" novalidate> <form action="" method="post" novalidate>
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
<p> <p>
{{ form.date.label }}<br> {{ form.start_time.label }}<br>
{{ form.date() }}<br> {{ form.start_time() }}<br>
{% for error in form.date.errors %} {% for error in form.start_time.errors %}
<span style="color: red;">[{{ error }}]</span> <span style="color: red;">[{{ error }}]</span>
{% endfor %} {% endfor %}
</p> </p>

Loading…
Cancel
Save