diff --git a/main.py b/main.py index b9fd26f..88943e4 100644 --- a/main.py +++ b/main.py @@ -44,11 +44,17 @@ def home(): @app.route("/statusUpdate", methods=["POST", "GET"]) def statusUpdate(): if people and request.method == "POST": - index = people.index(Person(request.form["name"])) - print(index) - people[index].status += 1 - if people[index].status == 3: - people.remove(people[index]) + if request.form.has_key("index"): + index = int(request.form["index"]) + people[index].status += 1 + if people[index].status == 3: + people.remove(people[index]) + if request.form.has_key("name"): + index = people.index(Person(request.form["name"])) + print(index) + people[index].status += 1 + if people[index].status == 3: + people.remove(people[index]) return redirect("/") @@ -56,7 +62,7 @@ def statusUpdate(): def addPerson(): if request.method == "POST": result = request.form - if result["name"]: + if result.has_key("name"): newPerson = Person(result["name"], result["remark"]) if newPerson not in people: people.append(newPerson) diff --git a/templates/home.html b/templates/home.html index d189d95..2c73561 100644 --- a/templates/home.html +++ b/templates/home.html @@ -21,8 +21,8 @@
-

Up te daten persoon

-

+ +

Zie hieronder de lijst van personen die een pannenkoek willen

@@ -37,7 +37,12 @@ {% for person in people[1:] %} - +
+
+ + +
+
{{ person.getName() + person.getRemark() + ": " }} {{ "Huidige status: " + person.getStatus() }}