From fc151535954629000895de64cea3e7c452fb1c84 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Mon, 5 Jul 2010 23:54:11 +0200 Subject: Only show right nav arrow, if the following month is not in the future --- controller.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'controller.py') 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: -- cgit v1.2.3-54-g00ecf