blob: bdefb7c66616011891efab3e5402dc8225a40f5b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
from flask import Flask, render_template, request
app = Flask(__name__)
SPORTS = ["Basketball", "Soccer", "Ultimate Frisbee"]
@app.route("/")
def index():
return render_template("index.html", sports=SPORTS)
@app.route("/register", methods=["POST"])
def register():
if not request.form.get("name") or request.form.get("sport") not in SPORTS:
return render_template("failure.html")
for sport in request.form.getlist("sport"):
if sport not in SPORTS:
return render_template("failure.html")
return render_template("success.html")
|