aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-04-12 12:12:52 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-04-12 12:12:52 +0200
commita019e8901b30526b9d7a5443c9355fe87ce620bf (patch)
tree3ad3128de9116c7e9ed9a891529c2f6f2e8af8ec /pyaggr3g470r/views.py
parentBetter use of the decorator 'feed_access_required'. (diff)
downloadnewspipe-a019e8901b30526b9d7a5443c9355fe87ce620bf.tar.gz
newspipe-a019e8901b30526b9d7a5443c9355fe87ce620bf.tar.bz2
newspipe-a019e8901b30526b9d7a5443c9355fe87ce620bf.zip
New ForeignKey between Article and User.
Diffstat (limited to 'pyaggr3g470r/views.py')
-rw-r--r--pyaggr3g470r/views.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 4f6a452c..d7263cdd 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -166,8 +166,8 @@ def home():
The home page lists most recent articles of all feeds.
"""
user = User.query.filter(User.email == g.user.email).first()
- #return render_template('home.html', user=user, head_title="nb unread")
- return render_template('home.html', user=user)
+ unread_articles = len(Article.query.filter(Article.user_id == g.user.id, Article.readed == False).all())
+ return render_template('home.html', user=user, head_title=unread_articles)
@app.route('/fetch/', methods=['GET'])
@app.route('/fetch/<feed_id>', methods=['GET'])
@@ -205,12 +205,11 @@ def feeds():
def feed(feed_id=None):
"""
Presents detailed information about a feed.
- The administrator of the platform is able to access to this view for every users.
"""
feed = Feed.query.filter(Feed.id == feed_id).first()
word_size = 6
articles = feed.articles.all()
- nb_articles = len(articles)
+ nb_articles = len(Article.query.filter(Article.user_id == g.user.id).all())
top_words = utils.top_words(articles, n=50, size=int(word_size))
tag_cloud = utils.tag_cloud(top_words)
bgstack15