aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-07-13 14:05:40 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-07-13 14:05:40 +0200
commit37a380a9beb5d179109095ea480962c435558330 (patch)
treee0a164dd79321d886d5da7a8719b2324256c95c8 /pyaggr3g470r
parentRemoved a trailing space. (diff)
downloadnewspipe-37a380a9beb5d179109095ea480962c435558330.tar.gz
newspipe-37a380a9beb5d179109095ea480962c435558330.tar.bz2
newspipe-37a380a9beb5d179109095ea480962c435558330.zip
Performance imporvement (loading of the management page).
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r--pyaggr3g470r/views.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 63e7437b..4f950891 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -613,14 +613,13 @@ def management():
else:
flash(gettext('File not allowed.'), 'danger')
-
form = AddFeedForm()
- #user = User.query.filter(User.id == g.user.id).first()
nb_feeds = len(g.user.feeds.all())
- nb_articles = len(Article.query.filter(Article.user_id == g.user.id).all())
- nb_unread_articles = len(Article.query.filter(Article.user_id == g.user.id, Article.readed == False).all())
- return render_template('management.html', user=g.user, form=form, \
- nb_feeds=nb_feeds, nb_articles=nb_articles, nb_unread_articles=nb_unread_articles, \
+ articles = Article.query.filter(Article.user_id == g.user.id)
+ nb_articles = articles.count()
+ nb_unread_articles = articles.filter(Article.readed == False).count()
+ return render_template('management.html', user=g.user, form=form,
+ nb_feeds=nb_feeds, nb_articles=nb_articles, nb_unread_articles=nb_unread_articles,
not_on_heroku = not conf.ON_HEROKU)
@app.route('/history', methods=['GET'])
bgstack15