aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2015-08-05 15:24:44 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2015-08-05 15:24:44 +0200
commit124650a26bb02540a9d00cc2195d0dd61c82c4d7 (patch)
tree587ad0b7972fad284689f22cd2513854887d4803 /pyaggr3g470r/views
parentSecure back redirects with WTForms. (diff)
downloadnewspipe-124650a26bb02540a9d00cc2195d0dd61c82c4d7.tar.gz
newspipe-124650a26bb02540a9d00cc2195d0dd61c82c4d7.tar.bz2
newspipe-124650a26bb02540a9d00cc2195d0dd61c82c4d7.zip
It is now possible to mark articles as read only older than 1 day or 10 days.
Diffstat (limited to 'pyaggr3g470r/views')
-rw-r--r--pyaggr3g470r/views/feed.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/pyaggr3g470r/views/feed.py b/pyaggr3g470r/views/feed.py
index afb51903..bdb4f046 100644
--- a/pyaggr3g470r/views/feed.py
+++ b/pyaggr3g470r/views/feed.py
@@ -3,7 +3,7 @@
import base64
import requests.exceptions
from hashlib import md5
-from datetime import datetime
+from datetime import datetime, timedelta
from sqlalchemy import desc
from werkzeug.exceptions import BadRequest
@@ -131,6 +131,12 @@ def bookmarklet():
def update(action, feed_id=None):
readed = action == 'read'
filters = {'readed__ne': readed}
+
+ nb_days = request.args.get('nb_days', None)
+ if nb_days is not None:
+ delete_before = datetime.now() - timedelta(days=int(nb_days))
+ filters['date__lt'] = delete_before
+
if feed_id:
filters['feed_id'] = feed_id
ArticleController(g.user.id).update(filters, {'readed': readed})
bgstack15