From 66485a40fb0e7a3905241c1fcfe10a6feef51a3b Mon Sep 17 00:00:00 2001 From: Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> Date: Tue, 9 Jul 2024 10:00:10 +0000 Subject: Tue, Jul 9, 2024, 3:00 AM -07:00 --- wk9/lect/froshims/app.py | 8 +++++--- wk9/lect/froshims/templates/index.html | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'wk9/lect/froshims') diff --git a/wk9/lect/froshims/app.py b/wk9/lect/froshims/app.py index 5d64a54..a60a291 100644 --- a/wk9/lect/froshims/app.py +++ b/wk9/lect/froshims/app.py @@ -2,13 +2,15 @@ from flask import Flask, render_template, request app = Flask(__name__) +SPORTS = ["Basketball", "Soccer", "Ultimate Frisbee"] + + @app.route("/") def index(): - return render_template("index.html") + return render_template("index.html", sports=SPORTS) @app.route("/register", methods=["POST"]) def register(): - - if not request.form.get("name") or not request.form.get("sport"): + if not request.form.get("name") or request.form.get("sport") not in SPORTS: return render_template("failure.html") return render_template("success.html") diff --git a/wk9/lect/froshims/templates/index.html b/wk9/lect/froshims/templates/index.html index d9920da..03eabb0 100644 --- a/wk9/lect/froshims/templates/index.html +++ b/wk9/lect/froshims/templates/index.html @@ -7,9 +7,9 @@ -- cgit v1.2.3