add create new form

This commit is contained in:
Thomas Lindner 2021-11-09 04:38:04 +01:00
parent f75b6abe61
commit f212dbe32d
3 changed files with 39 additions and 5 deletions

View file

@ -19,14 +19,29 @@ cursor.execute("""
@application.get("/")
@bottle.view("datentrog.tpl")
def datentrog_get():
return dict(event=bottle.request.query.get("event", "Heizhaus"))
def root_get():
return bottle.static_file("new.html", root="static")
@application.get("/static/<file:path>")
def datentrog_get(file):
return bottle.static_file(file, root="static")
@application.post("/")
@bottle.view("datentrog.tpl")
def datentrog_post():
bottle.redirect("event/" + bottle.request.forms.get("event", ""))
@application.get("/event/<event>")
@bottle.view("datentrog.tpl")
def event_get(event):
return dict(event=event)
@application.post("/event/<event>")
@bottle.view("datentrog.tpl")
def event_post(event):
data = {"feedback": True, "success": True}
for field in ("event", "name", "address", "contact"):
data[field] = bottle.request.forms.get(field, "")

View file

@ -11,7 +11,6 @@
% if get("success", False):
<p>Erfolgreich registriert.</p>
<form method="get">
<input type="hidden" name="event" value="{{ get("event", "Heizhaus") }}">
<button type="submit" class="btn btn-primary">Weitere Person registrieren</button>
</form>
% else:

20
static/new.html Normal file
View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<title>Corona-Kontaktformular - Neu erstellen</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h1>Corona-Kontaktformular</h1>
<form method="post">
<div class="form-group">
<label for="event">Veranstaltung:</label>
<input id="event" class="form-control" name="event" value="Kunstrasen">
</div>
<button type="submit" class="btn btn-success">Formular erstellen</button>
</form>
</div>
</body>
</html>