aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-23 11:03:46 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-23 11:03:46 +0200
commit646da3d66a457cb852a7ebf8a9d0b03b7bc272a1 (patch)
tree558ec4efecf88f8874d48789f20f92dbe1b42e0b
parentUpdated templates/profile.html. (diff)
downloadnewspipe-646da3d66a457cb852a7ebf8a9d0b03b7bc272a1.tar.gz
newspipe-646da3d66a457cb852a7ebf8a9d0b03b7bc272a1.tar.bz2
newspipe-646da3d66a457cb852a7ebf8a9d0b03b7bc272a1.zip
Display unread articles for one feed.
-rw-r--r--pyaggr3g470r/views.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index f73ba812..24175024 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -403,13 +403,17 @@ def favorites():
nb_favorites += length
return render_template('favorites.html', feeds=result, nb_favorites=nb_favorites)
+@app.route('/unread/<int:feed_id>/', methods=['GET'])
@app.route('/unread/', methods=['GET'])
@login_required
-def unread():
+def unread(feed_id=None):
"""
List unread articles.
"""
- feeds_with_unread = Feed.query.filter(Feed.user_id == g.user.id, Feed.articles.any(readed=False))
+ if feed_id is not None:
+ feeds_with_unread = Feed.query.filter(Feed.user_id == g.user.id, Feed.id == feed_id)
+ else:
+ feeds_with_unread = Feed.query.filter(Feed.user_id == g.user.id, Feed.articles.any(readed=False))
result, nb_unread = [], 0
for feed in feeds_with_unread:
new_feed = Feed()
bgstack15