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):
|
def rm(session: sa.orm.Session, index: int):
|
||||||
session.query(Task.id == index).delete()
|
session.query(Task).filter(Task.id == index).delete()
|
||||||
session.commit()
|
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):
|
def show_by_id(session: sa.orm.Session, index: int):
|
||||||
obj = session.query(Task.id == index)
|
obj = session.query(Task).filter(Task.id == index).one()
|
||||||
show_by_obj(obj)
|
show_by_obj(session, obj)
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user