diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-01-12 17:49:35 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-01-12 17:49:35 +0100 |
commit | 35c505c601ffee0fdc883d6a00c9ccd91a6486e8 (patch) | |
tree | 254c98f1689f8ea4cdc7fb31f99abd9b36c96ebf /pyaggr3g470r | |
parent | Only display this icon if the feed is enabled. (diff) | |
download | newspipe-35c505c601ffee0fdc883d6a00c9ccd91a6486e8.tar.gz newspipe-35c505c601ffee0fdc883d6a00c9ccd91a6486e8.tar.bz2 newspipe-35c505c601ffee0fdc883d6a00c9ccd91a6486e8.zip |
Display the number of unread articles in the Browser tab title.
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r-- | pyaggr3g470r/views.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index e44da631..1c1b1237 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -101,7 +101,8 @@ def home(): """ user = g.user feeds = models.User.objects(email=g.user.email).fields(slice__feeds__articles=9).first().feeds - return render_template('home.html', user=user, feeds=feeds) + return render_template('home.html', user=user, feeds=feeds, \ + head_title=models.Article.objects(readed=False).count()) @app.route('/fetch/', methods=['GET']) @app.route('/fetch/<feed_id>', methods=['GET']) @@ -335,8 +336,8 @@ def management(): nb_feeds = len(user.feeds) #nb_articles = sum([len(feed.articles) for feed in user.feeds]) #nb_unread_articles = sum([len([article for article in feed.articles if not article.readed]) for feed in user.feeds]) - nb_articles = len(models.Article.objects()) - nb_unread_articles = len(models.Article.objects(readed=False)) + nb_articles = models.Article.objects().count() + nb_unread_articles = models.Article.objects(readed=False).count() return render_template('management.html', form=form, \ nb_feeds=nb_feeds, nb_articles=nb_articles, nb_unread_articles=nb_unread_articles) |