aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-01-01 16:49:31 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-01-01 16:49:31 +0100
commitb4f26c158e654bdac0c055ad3d1d1fcbee2a931f (patch)
tree7c3ad85aafdf38689e03da201aba20583608248b /pyaggr3g470r/views.py
parentLink to the page to edit feed informations. (diff)
downloadnewspipe-b4f26c158e654bdac0c055ad3d1d1fcbee2a931f.tar.gz
newspipe-b4f26c158e654bdac0c055ad3d1d1fcbee2a931f.tar.bz2
newspipe-b4f26c158e654bdac0c055ad3d1d1fcbee2a931f.zip
Displaying more information in the /feed page.
Diffstat (limited to 'pyaggr3g470r/views.py')
-rw-r--r--pyaggr3g470r/views.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index e80890af..af2abc7b 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -144,7 +144,17 @@ def feed(feed_id=None):
articles = feed.articles
top_words = utils.top_words(articles, n=50, size=int(word_size))
tag_cloud = utils.tag_cloud(top_words)
- return render_template('feed.html', head_title=feed.title, feed=feed, tag_cloud=tag_cloud)
+
+ today = datetime.datetime.now()
+ last_article = articles[0].date
+ first_article = articles[-1].date
+ delta = last_article - first_article
+ average = round(float(len(articles)) / abs(delta.days), 2)
+ elapsed = today - last_article
+
+ return render_template('feed.html', head_title=feed.title, feed=feed, tag_cloud=tag_cloud, \
+ first_post_date=first_article, end_post_date=last_article , \
+ average=average, delta=delta, elapsed=elapsed)
@app.route('/article/<article_id>', methods=['GET'])
@login_required
bgstack15