summaryrefslogtreecommitdiff
path: root/controller.py
diff options
context:
space:
mode:
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:
"""