summaryrefslogtreecommitdiff
path: root/controller.py
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2010-07-05 23:54:11 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2010-07-05 23:54:11 +0200
commitfc151535954629000895de64cea3e7c452fb1c84 (patch)
tree041fa27f31f223175cf11a6de7191ca9a0b64cba /controller.py
parent47c0ab4982cb9ee9c15ce0d055ad830b1ec9e5b6 (diff)
downloadkosten-fc151535954629000895de64cea3e7c452fb1c84.tar.gz
kosten-fc151535954629000895de64cea3e7c452fb1c84.tar.bz2
kosten-fc151535954629000895de64cea3e7c452fb1c84.zip
Only show right nav arrow, if the following month is not in the future
Diffstat (limited to 'controller.py')
-rw-r--r--controller.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/controller.py b/controller.py
index 417046d..e194d22 100644
--- a/controller.py
+++ b/controller.py
@@ -14,7 +14,8 @@ from sqlalchemy import sql
class Show:
def GET(self, year = '', month = ''):
if year:
- return self.render([self.calc(year, month)])
+ c = self.calc(year, month)
+ return self.render([c], self.is_last(c))
else:
d = datetime.date.today()
@@ -24,7 +25,7 @@ class Show:
else:
second = self.calc(d.year, d.month - 1)
- return self.render([first, second])
+ return self.render([first, second], self.is_last(first))
def calc(self, year, month):
@@ -41,8 +42,11 @@ class Show:
return MonthExpense(datetime.date(int(year), int(month), 1), exps)
- def render(self, exps):
- return render("show", exps = exps)
+ def is_last(self, exp):
+ return exp.date >= datetime.date.today().replace(day = 1)
+
+ def render(self, exps, is_last):
+ return render("show", exps = exps, is_last = is_last)
class Add: