From 1a5abcfbf2c9ceb137b42c177013bd0f54d571fe Mon Sep 17 00:00:00 2001 From: "A.Avenel" Date: Sat, 3 Dec 2011 22:25:19 +0100 Subject: Fix for a bug introduced in last commit : crash of dashboard view when there is no bill. --- budget/models.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'budget/models.py') diff --git a/budget/models.py b/budget/models.py index b889794..3dcd709 100644 --- a/budget/models.py +++ b/budget/models.py @@ -44,6 +44,10 @@ class Project(db.Model): return balances + def has_bills(self): + """return if the project do have bills or not""" + return self.get_bills().count() != 0 + def get_bills(self): """Return the list of bills related to this project""" return Bill.query.join(Person, Project)\ -- cgit v1.1