Merge branch 'Updates' into 'master'
Updates See merge request kelder/pannenkoekenwachtrij!1
This commit is contained in:
commit
716ad05626
4 changed files with 40 additions and 10 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
.idea/
|
||||
*.pyc
|
||||
venv/
|
||||
|
|
9
main.py
9
main.py
|
@ -44,6 +44,13 @@ def home():
|
|||
@app.route("/statusUpdate", methods=["POST", "GET"])
|
||||
def statusUpdate():
|
||||
if people and request.method == "POST":
|
||||
result = request.form
|
||||
if "index" in result:
|
||||
index = int(request.form["index"])
|
||||
people[index].status += 1
|
||||
if people[index].status == 3:
|
||||
people.remove(people[index])
|
||||
if "name" in result:
|
||||
index = people.index(Person(request.form["name"]))
|
||||
print(index)
|
||||
people[index].status += 1
|
||||
|
@ -56,7 +63,7 @@ def statusUpdate():
|
|||
def addPerson():
|
||||
if request.method == "POST":
|
||||
result = request.form
|
||||
if result["name"]:
|
||||
if "name" in result:
|
||||
newPerson = Person(result["name"], result["remark"])
|
||||
if newPerson not in people:
|
||||
people.append(newPerson)
|
||||
|
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
flask
|
|
@ -1,6 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
background-color: #303030;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
<meta charset="UTF-8">
|
||||
<title>Pannenkoekenwachtrij</title>
|
||||
</head>
|
||||
|
@ -15,14 +21,28 @@
|
|||
</form>
|
||||
|
||||
<form action="/statusUpdate" method="POST">
|
||||
<p>Up te daten persoon <input type="text" name="name"></p>
|
||||
<p><input type="submit" value="Updaten"></p>
|
||||
<input type="hidden" name="index" value="0">
|
||||
<p><input type="submit" value="Update First Person"></p>
|
||||
</form>
|
||||
|
||||
<h2>Zie hieronder de lijst van personen die een pannenkoek willen</h2>
|
||||
<table>
|
||||
{% for person in people %}
|
||||
<h3>Volgende Persoon:</h3>
|
||||
{% if people %}
|
||||
<tr>
|
||||
<th>{{ people[0].getName() + people[0].getRemark() + ": " }}</th>
|
||||
<td>{{ "Huidige status: " + people[0].getStatus() }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<h3>Andere Personen:</h3>
|
||||
<table>
|
||||
{% for person in people[1:] %}
|
||||
<tr>
|
||||
<td>
|
||||
<form action="/statusUpdate" method="POST">
|
||||
<input type="hidden" name="name" value="{{ person.getName() }}">
|
||||
<input type="submit" value="Update">
|
||||
</form>
|
||||
</td>
|
||||
<th>{{ person.getName() + person.getRemark() + ": " }}</th>
|
||||
<td>{{ "Huidige status: " + person.getStatus() }}</td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in a new issue