diff options
Diffstat (limited to '')
-rw-r--r-- | controller.py | 10 | ||||
-rw-r--r-- | templates/pages/constadd.mako | 4 | ||||
-rw-r--r-- | templates/pages/constedit.mako | 5 |
3 files changed, 17 insertions, 2 deletions
diff --git a/controller.py b/controller.py index 55baa09..824c638 100644 --- a/controller.py +++ b/controller.py @@ -309,7 +309,15 @@ class ConstEdit (ConstAdd): def POST(self, id): exp = ConstExpense.get(id) self.get_expense = lambda *x: exp - return ConstAdd.POST(self) + + if "changeB" in web.input(): + return ConstAdd.POST(self) + elif "deleteB" in web.input(): + web.ctx.orm.delete(exp) + raise web.seeother("/const") + else: + return self.GET(id) + class Cat: def GET(self): diff --git a/templates/pages/constadd.mako b/templates/pages/constadd.mako index 68a276f..2c16544 100644 --- a/templates/pages/constadd.mako +++ b/templates/pages/constadd.mako @@ -6,7 +6,9 @@ <form name="add_const_expense" method="post"> ${form.render()} - <input type="submit" /> + <%block name="form_buttons"> + <input type="submit" name="changeB"/> + </%block> </form> <%block name="heading"> diff --git a/templates/pages/constedit.mako b/templates/pages/constedit.mako index 618df2e..7507bf9 100644 --- a/templates/pages/constedit.mako +++ b/templates/pages/constedit.mako @@ -3,3 +3,8 @@ <%block name="heading"> Konstante Ausgabe bearbeiten </%block> + +<%block name="form_buttons"> + <input type="submit" name="changeB" /> + <input type="submit" name="deleteB" value="Eintrag löschen" /> +</%block> |