add create new form
This commit is contained in:
parent
f75b6abe61
commit
f212dbe32d
23
datentrog.py
23
datentrog.py
|
@ -19,14 +19,29 @@ cursor.execute("""
|
||||||
|
|
||||||
|
|
||||||
@application.get("/")
|
@application.get("/")
|
||||||
@bottle.view("datentrog.tpl")
|
def root_get():
|
||||||
def datentrog_get():
|
return bottle.static_file("new.html", root="static")
|
||||||
return dict(event=bottle.request.query.get("event", "Heizhaus"))
|
|
||||||
|
|
||||||
|
@application.get("/static/<file:path>")
|
||||||
|
def datentrog_get(file):
|
||||||
|
return bottle.static_file(file, root="static")
|
||||||
|
|
||||||
|
|
||||||
@application.post("/")
|
@application.post("/")
|
||||||
@bottle.view("datentrog.tpl")
|
|
||||||
def datentrog_post():
|
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}
|
data = {"feedback": True, "success": True}
|
||||||
for field in ("event", "name", "address", "contact"):
|
for field in ("event", "name", "address", "contact"):
|
||||||
data[field] = bottle.request.forms.get(field, "")
|
data[field] = bottle.request.forms.get(field, "")
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
% if get("success", False):
|
% if get("success", False):
|
||||||
<p>Erfolgreich registriert.</p>
|
<p>Erfolgreich registriert.</p>
|
||||||
<form method="get">
|
<form method="get">
|
||||||
<input type="hidden" name="event" value="{{ get("event", "Heizhaus") }}">
|
|
||||||
<button type="submit" class="btn btn-primary">Weitere Person registrieren</button>
|
<button type="submit" class="btn btn-primary">Weitere Person registrieren</button>
|
||||||
</form>
|
</form>
|
||||||
% else:
|
% else:
|
||||||
|
|
20
static/new.html
Normal file
20
static/new.html
Normal 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>
|
Loading…
Reference in a new issue