diff options
Diffstat (limited to '')
-rw-r--r-- | controller.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/controller.py b/controller.py index 0e68491..34d06d9 100644 --- a/controller.py +++ b/controller.py @@ -188,15 +188,16 @@ class ConstAdd: CE = ConstExpense # get the list of 'previous' expenses - prev_list = CE.query.filter(CE.next == None) + filter = (CE.next == None) cur = self.get_expense() if cur.id is None: # empty session.expunge(cur) else: - prev_list = prev_list.filter(CE.id != cur.id) + filter = sql.or_(CE.next == cur, filter) + filter = sql.and_(filter, CE.id != cur.id) - prev_list = prev_list.order_by(CE.description).values(CE.id, CE.description) + prev_list = CE.query.filter(filter).order_by(CE.description).values(CE.id, CE.description) return Form( form.Textbox( |