Use show_by_obj for printing

This commit is contained in:
Danny Robson 2020-05-21 10:18:39 +10:00
parent 1bbbd799d1
commit 160f24cb4d

View File

@ -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)
###############################################################################