aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views.py
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-10-13 23:31:14 +0200
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-10-13 23:31:14 +0200
commit153724fc133f461dd800e4af2e591752489204b5 (patch)
tree6f283d389a89856ad57b988c7b0713047ef23fa5 /pyaggr3g470r/views.py
parentfixed bug in /articles page. (diff)
downloadnewspipe-153724fc133f461dd800e4af2e591752489204b5.tar.gz
newspipe-153724fc133f461dd800e4af2e591752489204b5.tar.bz2
newspipe-153724fc133f461dd800e4af2e591752489204b5.zip
Trying to sort articles (SortedListField(ReferenceField('Article')).
Diffstat (limited to 'pyaggr3g470r/views.py')
-rw-r--r--pyaggr3g470r/views.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index a1a2055f..fa67393a 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -17,7 +17,8 @@ mail = Mail()
@app.route('/')
def home():
- feeds = models.Feed.objects().order_by('title').fields(slice__articles=[0,9])
+ #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)
@app.route('/fetch/', methods=['GET'])
@@ -33,7 +34,7 @@ def about():
@app.route('/feeds/', methods=['GET'])
def feeds():
feeds = models.Feed.objects()
- return render_template('feedss.html', feeds=feeds)
+ return render_template('feeds.html', feeds=feeds)
@app.route('/feed/<feed_id>', methods=['GET'])
def feed(feed_id=None):
@@ -48,9 +49,18 @@ def article(article_id=None):
article.save()
return render_template('article.html', article=article)
+@app.route('/delete/<article_id>', methods=['GET'])
+def delete(article_id=None):
+ article = models.Article.objects(id=article_id).first()
+ article.delete()
+ article.save()
+ return redirect(url_for('home'))
+
@app.route('/articles/<feed_id>', methods=['GET'])
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