aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views.py
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-11-03 00:47:53 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-11-03 00:47:53 +0100
commitc6cab56905a5a2b42a949d78ce68d92a57890d09 (patch)
treeb833d865e12b6e0a527d83a8ed7b15ea67ed8dad /pyaggr3g470r/views.py
parentfeeds are compared with their ids (diff)
downloadnewspipe-c6cab56905a5a2b42a949d78ce68d92a57890d09.tar.gz
newspipe-c6cab56905a5a2b42a949d78ce68d92a57890d09.tar.bz2
newspipe-c6cab56905a5a2b42a949d78ce68d92a57890d09.zip
Page for favorites articles.
Diffstat (limited to 'pyaggr3g470r/views.py')
-rw-r--r--pyaggr3g470r/views.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index c390ddc0..d487c1ec 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -147,18 +147,18 @@ def articles(feed_id=None):
user = models.User.objects(email=g.user.email, feeds__oid=feed_id).first()
for feed in user.feeds:
if str(feed.oid) == feed_id:
- return render_template('articles.html', feed=user.feeds[0])
+ return render_template('articles.html', feed=user.feeds)
@app.route('/favorites/', methods=['GET'])
@login_required
def favorites():
- favorites = defaultdict(list)
- for feed in models.Feed.objects():
- for article in feed.articles:
- if article.like:
- favorites[feed.title].append(article)
-
- return render_template('favorites.html', favorites=favorites)
+ user = models.User.objects(email=g.user.email).first()
+ result = []
+ for feed in user.feeds:
+ feed.articles = [article for article in feed.articles if article.like]
+ if len(feed.articles) != 0:
+ result.append(feed)
+ return render_template('favorites.html', feeds=result)
@app.route('/unread/', methods=['GET'])
@login_required
bgstack15