diff options
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r-- | pyaggr3g470r/views.py | 4 |
1 files changed, 3 insertions, 1 deletions
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()) |