diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-08-05 15:24:44 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-08-05 15:24:44 +0200 |
commit | 124650a26bb02540a9d00cc2195d0dd61c82c4d7 (patch) | |
tree | 587ad0b7972fad284689f22cd2513854887d4803 | |
parent | Secure back redirects with WTForms. (diff) | |
download | newspipe-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.
-rw-r--r-- | pyaggr3g470r/templates/layout.html | 2 | ||||
-rw-r--r-- | pyaggr3g470r/views/feed.py | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/pyaggr3g470r/templates/layout.html b/pyaggr3g470r/templates/layout.html index 93d36096..9b767649 100644 --- a/pyaggr3g470r/templates/layout.html +++ b/pyaggr3g470r/templates/layout.html @@ -67,6 +67,8 @@ <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ _('Feed') }} <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="{{ url_for("feeds.update", action="read") }}">{{ _('Mark all as read') }}</a></li> + <li><a href="{{ url_for("feeds.update", action="read", nb_days="1") }}">{{ _('Mark all as read older than yesterday') }}</a></li> + <li><a href="{{ url_for("feeds.update", action="read", nb_days="10") }}">{{ _('Mark all as read older than 10 days') }}</a></li> <li role="presentation" class="divider"></li> <li><a href="{{ url_for("inactives") }}">{{ _('Inactive') }}</a></li> <li><a href="{{ url_for("history") }}">{{ _('History') }}</a></li> 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}) |