aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2015-05-17 11:13:01 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2015-05-17 11:13:01 +0200
commitf262b4bc7729716bff75faaf8015e22015db2d0e (patch)
tree9a7ac2eca80377ba85d6a2d1bf740d2e3a50570f /pyaggr3g470r/views
parentThe web server should run on 0.0.0.0 for Vagrant. (diff)
downloadnewspipe-f262b4bc7729716bff75faaf8015e22015db2d0e.tar.gz
newspipe-f262b4bc7729716bff75faaf8015e22015db2d0e.tar.bz2
newspipe-f262b4bc7729716bff75faaf8015e22015db2d0e.zip
Finally, the side menu was easier to understand before.
Diffstat (limited to 'pyaggr3g470r/views')
-rw-r--r--pyaggr3g470r/views/views.py13
1 files changed, 2 insertions, 11 deletions
diff --git a/pyaggr3g470r/views/views.py b/pyaggr3g470r/views/views.py
index 3abc76df..5897bc9e 100644
--- a/pyaggr3g470r/views/views.py
+++ b/pyaggr3g470r/views/views.py
@@ -246,6 +246,7 @@ def render_home(filters=None, head_titles=None,
arti_contr = ArticleController(g.user.id)
feeds = {feed.id: feed.title for feed in feed_contr.read()}
+ unread = arti_contr.get_unread()
in_error = {feed.id: feed.error_count for feed in
feed_contr.read(error_count__gt=2)}
@@ -268,19 +269,9 @@ def render_home(filters=None, head_titles=None,
}.get(sort_, Article.date.desc())
articles = arti_contr.read(**filters).order_by(sort_param)
- unread_counter = {}
if limit != 'all':
limit = int(limit)
articles = articles.limit(limit)
- {article.feed_id: 1
- if article.feed_id not in unread_counter and
- not unread_counter.update({article.feed_id: 1})
- else unread_counter[article.feed_id] + 1
- if not unread_counter.update({article.feed_id:
- unread_counter[article.feed_id] + 1})
- else 1
- for article in articles if article.readed==False
- }
def gen_url(filter_=filter_, sort_=sort_, limit=limit, feed_id=feed_id,
**kwargs):
@@ -301,7 +292,7 @@ def render_home(filters=None, head_titles=None,
return render_template('home.html', gen_url=gen_url, feed_id=feed_id,
filter_=filter_, limit=limit, feeds=feeds,
- unread=unread_counter, articles=articles, in_error=in_error,
+ unread=unread, articles=articles, in_error=in_error,
head_titles=head_titles, sort_=sort_, **kwargs)
bgstack15