validate length

stable
neingeist 6 years ago
parent 73798364aa
commit 79c8b6d5c6

@ -3,7 +3,7 @@ from flask import (Flask, render_template, flash, redirect,
from flask_bootstrap import Bootstrap
from flask_wtf import FlaskForm
from wtforms import DateTimeField, DecimalField, SubmitField
from wtforms.validators import DataRequired
from wtforms.validators import DataRequired, NumberRange
from datetime import datetime, timedelta
@ -17,7 +17,8 @@ Bootstrap(app)
class DownloadForm(FlaskForm):
start_time = DateTimeField('Start time', validators=[DataRequired()])
length = DecimalField('Length', validators=[DataRequired()])
length = DecimalField('Length', validators=[DataRequired(),
NumberRange(min=1, max=180)])
submit = SubmitField('Download')

Loading…
Cancel
Save