Use the proper construction for 'where' clauses
This commit is contained in:
parent
160f24cb4d
commit
d4f4af9398
@ -18,7 +18,7 @@ def add(session: sa.orm.Session, title: str):
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def rm(session: sa.orm.Session, index: int):
|
||||
session.query(Task.id == index).delete()
|
||||
session.query(Task).filter(Task.id == index).delete()
|
||||
session.commit()
|
||||
|
||||
|
||||
@ -29,8 +29,8 @@ def show_by_obj(session: sa.orm.Session, obj: Task):
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def show_by_id(session: sa.orm.Session, index: int):
|
||||
obj = session.query(Task.id == index)
|
||||
show_by_obj(obj)
|
||||
obj = session.query(Task).filter(Task.id == index).one()
|
||||
show_by_obj(session, obj)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user