summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2013-04-05 20:48:07 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2013-04-05 20:48:07 +0200
commitd6089be1fac75a58cce3e6d0f4379b3f0d362691 (patch)
treeec4b32bf8d9a420f779f1f7b857bc51764fd45da
parent9b8c0af63a87523185f2ddadf47454e051062040 (diff)
downloadkosten-d6089be1fac75a58cce3e6d0f4379b3f0d362691.tar.gz
kosten-d6089be1fac75a58cce3e6d0f4379b3f0d362691.tar.bz2
kosten-d6089be1fac75a58cce3e6d0f4379b3f0d362691.zip
Delete entries
Diffstat (limited to '')
-rw-r--r--controller.py8
-rw-r--r--templates/pages/add.mako4
-rw-r--r--templates/pages/edit.mako5
3 files changed, 15 insertions, 2 deletions
diff --git a/controller.py b/controller.py
index 470bf1f..55baa09 100644
--- a/controller.py
+++ b/controller.py
@@ -137,7 +137,13 @@ class Edit (Add):
exp = SingleExpense.get(id)
self.get_expense = lambda *x: exp
- return Add.POST(self)
+ if "changeB" in web.input():
+ return Add.POST(self)
+ elif "deleteB" in web.input():
+ web.ctx.orm.delete(exp)
+ self.return_()
+ else:
+ return self.GET(id)
def return_(self):
raise web.seeother("/")
diff --git a/templates/pages/add.mako b/templates/pages/add.mako
index c1f4ae7..3ce46fd 100644
--- a/templates/pages/add.mako
+++ b/templates/pages/add.mako
@@ -6,7 +6,9 @@
<form name="add_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/edit.mako b/templates/pages/edit.mako
index 37c93dd..1343136 100644
--- a/templates/pages/edit.mako
+++ b/templates/pages/edit.mako
@@ -3,3 +3,8 @@
<%block name="heading">
Bearbeite Kosteneintrag
</%block>
+
+<%block name="form_buttons">
+ <input type="submit" name="changeB" />
+ <input type="submit" name="deleteB" value="Eintrag löschen" />
+</%block>