Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DestinationForm(FlaskForm):
- journeyName = StringField("Name this Journey", validators=[DataRequired(), Length(min=2, max=20, message="Journey Name must be between 2 and 20 characters long.")])
- busNumber = IntegerField("Select Bus Number", validators=[DataRequired(), NumberRange(min=2, max=975, message="Invalid Bus Number")])
- journeyFrom = StringField("Bus Stop Code", validators=[DataRequired()])
- journeyTo = StringField("Destination", validators=[DataRequired()])
- alertMe = IntegerField("Alert Me Before {?} Stops", validators=[DataRequired(), NumberRange(min=1, max=7, message="Out of range! Between 1 to 7 only")])
- submit = SubmitField("Submit")
- @app.route("/destination", methods=['GET', 'POST'])
- def destination():
- form = DestinationForm()
- if form.validate_on_submit():
- flash(f'You are in transit, on Bus {form.busNumber.data}!', 'danger')
- return redirect("transit")
- return render_template("destinationForm.html", title="Destination",
- form=form)
Add Comment
Please, Sign In to add comment