diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-07-13 14:05:40 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-07-13 14:05:40 +0200 |
commit | 37a380a9beb5d179109095ea480962c435558330 (patch) | |
tree | e0a164dd79321d886d5da7a8719b2324256c95c8 /pyaggr3g470r | |
parent | Removed a trailing space. (diff) | |
download | newspipe-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.py | 11 |
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']) |