add retrival of last ticket

This commit is contained in:
fram3d 2023-10-03 21:24:01 +02:00
parent e794fc6032
commit be7dcf5903
Signed by: fram3d
GPG Key ID: 938920E709EEA32A

View File

@ -3,10 +3,20 @@ from freeriders import app, db
from freeriders.models import Ticket from freeriders.models import Ticket
import time import time
@app.route('/', methods=['POST', 'GET']) @app.route('/sms', methods=['GET'])
def changepassword(): def sms():
if request.method == 'GET': 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': elif request.method == 'POST':
timenow = int(time.time()) timenow = int(time.time())
ticket_input = request.form['ticket'] ticket_input = request.form['ticket']