From be7dcf59038c0b5fb70f18caa77126b28ae658dd Mon Sep 17 00:00:00 2001 From: fram3d Date: Tue, 3 Oct 2023 21:24:01 +0200 Subject: [PATCH] add retrival of last ticket --- freeriders/routes.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/freeriders/routes.py b/freeriders/routes.py index 92ce069..f6ff73c 100644 --- a/freeriders/routes.py +++ b/freeriders/routes.py @@ -3,10 +3,20 @@ from freeriders import app, db from freeriders.models import Ticket import time -@app.route('/', methods=['POST', 'GET']) -def changepassword(): +@app.route('/sms', methods=['GET']) +def sms(): if request.method == 'GET': - return render_template('index.html') + try: + lastticket = Ticket.query.order_by(Ticket.timestamp.desc()).first() + return render_template('sms.html', ticket = lastticket) + except: + return 'Error retriving last ticket' + else: + return 'HTTP request method not recogniezed' +@app.route('/submit', methods=['POST', 'GET']) +def submit(): + if request.method == 'GET': + return render_template('submit.html') elif request.method == 'POST': timenow = int(time.time()) ticket_input = request.form['ticket']