diff options
author | Cédric Bonhomme <kimble.mandel+bitbucket@gmail.com> | 2015-04-12 15:46:06 +0200 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel+bitbucket@gmail.com> | 2015-04-12 15:46:06 +0200 |
commit | dba34e9840e812aff4b13978a958e4c01a0644d2 (patch) | |
tree | a882749ba2ab5090188bc2ab5987aec81eb57eb1 /pyaggr3g470r/controllers/article.py | |
parent | Updated bootstrap. (diff) | |
parent | improving look and feel of home page (diff) | |
download | newspipe-dba34e9840e812aff4b13978a958e4c01a0644d2.tar.gz newspipe-dba34e9840e812aff4b13978a958e4c01a0644d2.tar.bz2 newspipe-dba34e9840e812aff4b13978a958e4c01a0644d2.zip |
Merged in jaesivsm/pyaggr3g470r (pull request #8)
again miscellaneous improvements
Diffstat (limited to 'pyaggr3g470r/controllers/article.py')
-rw-r--r-- | pyaggr3g470r/controllers/article.py | 9 |
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()) |