aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-01-30 21:34:48 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-01-30 21:34:48 +0100
commit4e773ab1830be5f8d9723a6a84b2c448537737e8 (patch)
tree03af0523df266470121c241441ca72917fd5bbce /pyaggr3g470r/views.py
parentMerge branch 'master' of bitbucket.org:cedricbonhomme/pyaggr3g470r (diff)
downloadnewspipe-4e773ab1830be5f8d9723a6a84b2c448537737e8.tar.gz
newspipe-4e773ab1830be5f8d9723a6a84b2c448537737e8.tar.bz2
newspipe-4e773ab1830be5f8d9723a6a84b2c448537737e8.zip
Updated template with Bootstrap 3.1 headers.
Diffstat (limited to 'pyaggr3g470r/views.py')
-rw-r--r--pyaggr3g470r/views.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index b53b03c3..78508179 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -239,11 +239,14 @@ def favorites():
"""
user = models.User.objects(email=g.user.email).first()
result = []
+ nb_favorites = 0
for feed in user.feeds:
feed.articles = [article for article in feed.articles if article.like]
- if len(feed.articles) != 0:
+ length = len(feed.articles)
+ if length != 0:
result.append(feed)
- return render_template('favorites.html', feeds=result)
+ nb_favorites += length
+ return render_template('favorites.html', feeds=result, nb_favorites=nb_favorites)
@app.route('/unread/', methods=['GET'])
@login_required
@@ -253,11 +256,14 @@ def unread():
"""
user = models.User.objects(email=g.user.email).first()
result = []
+ nb_unread = 0
for feed in user.feeds:
feed.articles = [article for article in feed.articles if not article.readed]
- if len(feed.articles) != 0:
+ length = len(feed.articles)
+ if length != 0:
result.append(feed)
- return render_template('unread.html', feeds=result)
+ nb_unread += length
+ return render_template('unread.html', feeds=result, nb_unread=nb_unread)
@app.route('/inactives/', methods=['GET'])
@login_required
bgstack15