aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-10-27 11:40:30 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-10-27 11:40:30 +0100
commit4cf3a57915c94e92170fde6ea99b472839e49ba4 (patch)
tree77b1bcf46b8d267167ac1dcda700ab2914c4320d
parentRemoved debug print. (diff)
downloadnewspipe-4cf3a57915c94e92170fde6ea99b472839e49ba4.tar.gz
newspipe-4cf3a57915c94e92170fde6ea99b472839e49ba4.tar.bz2
newspipe-4cf3a57915c94e92170fde6ea99b472839e49ba4.zip
Sort articles on the main page.
-rw-r--r--pyaggr3g470r/views.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index c5f42921..517369fe 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -18,8 +18,11 @@ mail = Mail()
@app.route('/')
def home():
#feeds = models.Feed.objects().order_by('title').fields(slice__articles=[0,9])
- feeds = models.Feed.objects().fields(slice__articles=[0,9])
- return render_template('home.html', feeds=feeds)
+ #feeds = models.Feed.objects().fields(slice__articles=[0,9])
+ feeds = models.Feed.objects()
+ for feed in feeds:
+ feed.articles = sorted(feed.articles, key=lambda t: t.date, reverse=True)
+ return render_template('home.html', feeds=feeds.fields(slice__articles=[0,9]))
@app.route('/fetch/', methods=['GET'])
def fetch():
@@ -60,7 +63,6 @@ def delete(article_id=None):
def articles(feed_id=None):
feed = models.Feed.objects(id=feed_id).first()
feed.articles = sorted(feed.articles, key=lambda t: t.date, reverse=True)
- feed.save()
return render_template('articles.html', feed=feed)
@app.route('/favorites/', methods=['GET'])
bgstack15