diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-04-18 14:28:10 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-04-18 14:28:10 +0200 |
commit | 771a6610fd0653c8f5248e19b9ca70e5fa8c9126 (patch) | |
tree | 7d22b538468992e2d4a0ee5c3b2ed7d72fb4133c /src/web/views/home.py | |
parent | fixing relative date translations (diff) | |
download | newspipe-771a6610fd0653c8f5248e19b9ca70e5fa8c9126.tar.gz newspipe-771a6610fd0653c8f5248e19b9ca70e5fa8c9126.tar.bz2 newspipe-771a6610fd0653c8f5248e19b9ca70e5fa8c9126.zip |
models.Article is not imported here...
Diffstat (limited to 'src/web/views/home.py')
-rw-r--r-- | src/web/views/home.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/web/views/home.py b/src/web/views/home.py index dfda381a..f53299dc 100644 --- a/src/web/views/home.py +++ b/src/web/views/home.py @@ -97,6 +97,11 @@ def _get_filters(in_dict): @jsonify def _articles_to_json(articles, fd_hash=None): now, locale = datetime.now(), get_locale() + fd_hash = {feed.id: {'title': feed.title, + 'icon_url': url_for('icon.icon', url=feed.icon_url) + if feed.icon_url else None} + for feed in FeedController(current_user.id).read()} + return {'articles': [{'title': art.title, 'liked': art.like, 'read': art.readed, 'article_id': art.id, 'selected': False, 'feed_id': art.feed_id, 'category_id': art.category_id or 0, @@ -115,12 +120,8 @@ def _articles_to_json(articles, fd_hash=None): def get_middle_panel(): filters = _get_filters(request.args) art_contr = ArticleController(current_user.id) - fd_hash = {feed.id: {'title': feed.title, - 'icon_url': url_for('icon.icon', url=feed.icon_url) - if feed.icon_url else None} - for feed in FeedController(current_user.id).read()} - articles = art_contr.read(**filters).order_by(Article.date.desc()) - return _articles_to_json(articles, fd_hash) + articles = art_contr.read_light(**filters) + return _articles_to_json(articles) @current_app.route('/getart/<int:article_id>') |