diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-08-20 17:10:44 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-08-20 17:10:44 +0200 |
commit | 733bc403a2c13b7b44a0b5be5c677048c53ca489 (patch) | |
tree | 6c386c0d0f7658cc77f3df832a73a8dbc7e96809 | |
parent | It is now possible to delete articles older than a given number of weeks. (diff) | |
download | newspipe-733bc403a2c13b7b44a0b5be5c677048c53ca489.tar.gz newspipe-733bc403a2c13b7b44a0b5be5c677048c53ca489.tar.bz2 newspipe-733bc403a2c13b7b44a0b5be5c677048c53ca489.zip |
Confirmation of deletion.
-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()) |