From 733bc403a2c13b7b44a0b5be5c677048c53ca489 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Wed, 20 Aug 2014 17:10:44 +0200 Subject: Confirmation of deletion. --- pyaggr3g470r/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index 3033f4c0..78aa174e 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -750,8 +750,10 @@ def expire_articles(): """ current_time = datetime.datetime.utcnow() weeks_ago = current_time - datetime.timedelta(weeks=int(request.args.get('weeks', 10))) - for article in Article.query.filter(User.email == g.user.email, Article.date < weeks_ago).all(): + articles_to_delete = Article.query.filter(User.email == g.user.email, Article.date < weeks_ago) + for article in articles_to_delete: db.session.delete(article) + flash(gettext('Articles deleted.'), 'info') db.session.commit() return redirect(redirect_url()) -- cgit