summaryrefslogtreecommitdiff
path: root/controller.py
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2010-07-27 01:16:48 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2010-07-27 01:16:48 +0200
commit98e83d8ffc9cc31986fb2672140aed005480cddb (patch)
tree271dbca8f1f75d8c7de812e35a8a5af7eb6ea7cc /controller.py
parentf3ce6573eeae4a62ed1fc771de16574e246dbac5 (diff)
downloadkosten-98e83d8ffc9cc31986fb2672140aed005480cddb.tar.gz
kosten-98e83d8ffc9cc31986fb2672140aed005480cddb.tar.bz2
kosten-98e83d8ffc9cc31986fb2672140aed005480cddb.zip
Add category manipulation support
Diffstat (limited to 'controller.py')
-rw-r--r--controller.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/controller.py b/controller.py
index 6db7b31..64b7af7 100644
--- a/controller.py
+++ b/controller.py
@@ -210,12 +210,19 @@ class ConstEdit (ConstAdd):
return ConstAdd.POST(self)
class Cat:
- def GET(self, id = '/'):
- if id:
- id = id[1:]
+ def GET(self):
+ categories = Category.query.order_by(Category.name).all()
+
+ return render("cats", cats = categories)
+
+ def POST(self):
+ for id, name in web.input().iteritems():
+ if id.startswith("n-"):
+ Category(name = name)
+ else:
+ Category.get(id).name = name
- if not id: return "Add new cat"
- else: return "Edit cat " + id
+ raise web.seeother("/")
class FourOhFour:
"""