From 160f24cb4d55b44beafa1a479658a7fbef30b776 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 21 May 2020 10:18:39 +1000 Subject: [PATCH] Use show_by_obj for printing --- src/pyelephant.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pyelephant.py b/src/pyelephant.py index 86990d4..e9732ad 100755 --- a/src/pyelephant.py +++ b/src/pyelephant.py @@ -10,8 +10,10 @@ Task = None ############################################################################### def add(session: sa.orm.Session, title: str): - session.add(Task(title=title)) + obj = Task(title=title) + session.add(obj) session.commit() + show_by_obj(obj) # ----------------------------------------------------------------------------- @@ -34,7 +36,7 @@ def show_by_id(session: sa.orm.Session, index: int): # ----------------------------------------------------------------------------- def ls(session: sa.orm.Session): for i in session.query(Task).order_by(Task.created_at): - print(i.id, i.created_at, i.title) + show_by_obj(session, i) ###############################################################################