diff --git a/freeriders/routes.py b/freeriders/routes.py index e21eca6..85b0038 100644 --- a/freeriders/routes.py +++ b/freeriders/routes.py @@ -1,6 +1,6 @@ from flask import render_template, request, redirect from freeriders import app, db -from freeriders.models import Ticket +from freeriders.models import Tickets from datetime import datetime import time @@ -8,7 +8,8 @@ import time def sms(): if request.method == 'GET': try: - lastticket = Ticket.query.order_by(Ticket.timestamp.desc()).first() + lastticket = Tickets.query.order_by(Tickets.timestamp.desc()).first().ticket + lastticket = "{:010d}".format(lastticket) date = datetime.now() datenow = f'{"{:02d}".format(date.day)}.{"{:02d}".format(date.month)}.{date.year}' timenow = f'{"{:02d}".format(date.hour)}:{"{:02d}".format(date.minute)}:{date.second}' @@ -27,7 +28,7 @@ def submit(): ticket_input = request.form['ticket'] if ticket_input.isdigit() and len(ticket_input) == 10: - ticket = Ticket(ticket = int(ticket_input), timestamp = timenow) + ticket = Tickets(ticket = int(ticket_input), timestamp = timenow) else: return 'Ticket format is wrong. Only 10 digits allowed.' diff --git a/freeriders/templates/index.html b/freeriders/templates/index.html deleted file mode 100644 index 8d81d5b..0000000 --- a/freeriders/templates/index.html +++ /dev/null @@ -1,14 +0,0 @@ - - -
- - - - -