Use show_by_obj for printing
This commit is contained in:
parent
1bbbd799d1
commit
160f24cb4d
@ -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)
|
||||
|
||||
|
||||
###############################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user