From 9d1f098d8a366e5ec5e0a7e63c2c51267b674078 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 12 Jul 2020 16:33:17 +0100 Subject: [PATCH] Fix clear notifications creating null user_ids --- app/blueprints/notifications/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/blueprints/notifications/__init__.py b/app/blueprints/notifications/__init__.py index f5e2d2bc..2d291983 100644 --- a/app/blueprints/notifications/__init__.py +++ b/app/blueprints/notifications/__init__.py @@ -17,7 +17,7 @@ from flask import Blueprint, render_template, redirect, url_for from flask_user import current_user, login_required -from app.models import db +from app.models import db, Notification bp = Blueprint("notifications", __name__) @@ -29,6 +29,6 @@ def list_all(): @bp.route("/notifications/clear/", methods=["POST"]) @login_required def clear(): - current_user.notifications.clear() + Notification.query.filter_by(user=current_user).delete() db.session.commit() return redirect(url_for("notifications.list_all"))