From 6a64f3f24d4707149913fcbc70014fb19a6143f4 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Thu, 4 Jul 2024 22:00:02 +0100 Subject: [PATCH] Fix SQLAlchemy error by using ids not mapped instances --- app/utils/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/utils/models.py b/app/utils/models.py index 4fe3396a..ec443deb 100644 --- a/app/utils/models.py +++ b/app/utils/models.py @@ -88,7 +88,7 @@ def add_notification(target, causer: User, type: NotificationType, title: str, u if target.rank.at_least(UserRank.NEW_MEMBER) and target != causer: session.query(Notification) \ - .filter_by(user=target, causer=causer, type=type, title=title, url=url, package=package) \ + .filter_by(user_id=target.id, causer_id=causer.id, type=type, title=title, url=url, package_id=package.id) \ .delete() notif = Notification(target, causer, type, title, url, package) session.add(notif)