aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/controllers
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2015-04-08 14:52:14 +0200
committerFrançois Schmidts <francois.schmidts@gmail.com>2015-04-12 14:31:06 +0200
commit5dfa537113c65a0596589c3683f7dba69323e8a7 (patch)
tree2e8889432e438ebaceb5fd41c7f807b0edfc9499 /pyaggr3g470r/controllers
parentmoving feed views related code in views.feed and massive use of url_for (diff)
downloadnewspipe-5dfa537113c65a0596589c3683f7dba69323e8a7.tar.gz
newspipe-5dfa537113c65a0596589c3683f7dba69323e8a7.tar.bz2
newspipe-5dfa537113c65a0596589c3683f7dba69323e8a7.zip
getting things out of the view a little more
Diffstat (limited to 'pyaggr3g470r/controllers')
-rw-r--r--pyaggr3g470r/controllers/article.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/pyaggr3g470r/controllers/article.py b/pyaggr3g470r/controllers/article.py
index 46ca0988..0ec53a2f 100644
--- a/pyaggr3g470r/controllers/article.py
+++ b/pyaggr3g470r/controllers/article.py
@@ -1,3 +1,6 @@
+from sqlalchemy import func
+
+from bootstrap import db
import conf
from .abstract import AbstractController
from pyaggr3g470r.models import Article
@@ -25,3 +28,9 @@ class ArticleController(AbstractController):
if self.read(**id_).first():
continue
yield id_
+
+ def get_unread(self):
+ return dict(db.session.query(Article.feed_id, func.count(Article.id))
+ .filter(Article.readed == False,
+ Article.user_id == self.user_id)
+ .group_by(Article.feed_id).all())
bgstack15