Commit b2490eac authored by jan-pieter's avatar jan-pieter

added initial very ugly version, it works...

parent 0ccb204d
from flask import Flask, render_template, request, redirect, url_for
app = Flask(__name__)
class Person:
statusses = ["Pannenkoek besteld", "Pannenkoek aan het bakken", "Pannenkoek klaar", "Pannenkoek afgegeven"]
def __init__(self, name, remark=""): = name
self.remark = remark.strip()
self.status = 0
def getRemark(self):
return "({})".format(self.remark) if self.remark else self.remark
def getName(self):
def __eq__(self, other):
return ==
def getStatus(self):
return self.statusses[self.status]
def nextStatus(self):
return self.statusses[self.status + 1]
def __str__(self):
return "Persoon: {} met status: {}".format(, self.status)
def __repr__(self):
return str(self)
people = []
def home():
return render_template("home.html", people=people)
def statusUpdate():
if people:
people[0].status += 1
if people[0].status == 3:
return redirect("/")
@app.route("/addPerson", methods=["POST", "GET"])
def addPerson():
if request.method == "POST":
result = request.form
newPerson = Person(request.form["name"], request.form["remark"])
if newPerson not in people:
return redirect("/")
if __name__ == "__main__":
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<h1>Welkom bij de pannenkoekenwachtrij</h1>
<form action="/addPerson" method="POST">
<p>Naam van de volgende <input type="text" name="name"></p>
<p>Specifieke opmerkingen <input type="text" name="remark"></p>
<p><input type="submit" value="Persoon toevoegen"></p>
<h2>Zie hieronder de lijst van personen die een pannenkoek willen</h2>
{% for person in people %}
<th>{{ person.getName() + person.getRemark() + ": " }}</th>
<a href="/statusUpdate">
<input type="button" value="{{ person.nextStatus() }}"/>
<td>{{ "Huidige status: " + person.getStatus() }}</td>
{% endfor %}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment