aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-11-17 23:17:24 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-11-17 23:17:24 +0100
commitceee9a32841b0909e027c6550a25bc7ef5948a26 (patch)
tree734630db559de4be4def34f778639a497977f8c0 /pyaggr3g470r
parentMinor improvements in utils.py. (diff)
downloadnewspipe-ceee9a32841b0909e027c6550a25bc7ef5948a26.tar.gz
newspipe-ceee9a32841b0909e027c6550a25bc7ef5948a26.tar.bz2
newspipe-ceee9a32841b0909e027c6550a25bc7ef5948a26.zip
List of inavtive feeds.
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r--pyaggr3g470r/templates/layout.html1
-rw-r--r--pyaggr3g470r/views.py20
2 files changed, 19 insertions, 2 deletions
diff --git a/pyaggr3g470r/templates/layout.html b/pyaggr3g470r/templates/layout.html
index f649f2ca..541c0ad8 100644
--- a/pyaggr3g470r/templates/layout.html
+++ b/pyaggr3g470r/templates/layout.html
@@ -50,6 +50,7 @@
<ul class="dropdown-menu">
<li><a href="/unread/">Unread</a></li>
<li><a href="/favorites/">Favorites</a></li>
+ <li><a href="/inactives/">Inactive feeds</a></li>
<li><a href="/history/">History</a></li>
</ul>
</li>
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 7b156b9f..62f5ae5e 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -26,12 +26,11 @@ __revision__ = "$Date: 2013/11/10 $"
__copyright__ = "Copyright (c) Cedric Bonhomme"
__license__ = "GPLv3"
+import datetime
from flask import render_template, request, flash, session, url_for, redirect, g
from wtforms import TextField, PasswordField, SubmitField, validators
-
from flask.ext.login import LoginManager, login_user, logout_user, login_required, current_user, AnonymousUserMixin
-
from collections import defaultdict
from forms import SigninForm, AddFeedForm
@@ -205,6 +204,23 @@ def unread():
result.append(feed)
return render_template('unread.html', feeds=result)
+@app.route('/inactives/', methods=['GET'])
+@login_required
+def inactives():
+ """
+ List of inactive feeds.
+ """
+ nb_days = int(request.args.get('nb_days', 365))
+ user = models.User.objects(email=g.user.email).first()
+ today = datetime.datetime.now()
+ inactives = []
+ for feed in user.feeds:
+ last_post = feed.articles[0].date
+ elapsed = today - last_post
+ if elapsed > datetime.timedelta(days=nb_days):
+ inactives.append((feed, elapsed))
+ return render_template('inactives.html', inactives=inactives, nb_days=nb_days)
+
@app.route('/search/', methods=['GET'])
@login_required
def search():
bgstack15