aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2014-02-03 07:37:29 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2014-02-03 07:37:29 +0100
commitf1af56fb0f5b6e42b87cb6f1145cf8773b3f46b4 (patch)
tree81b3c1d361f6019cc6373da1a05eb8833426902b
parentRemoved import of 'conf' module. (diff)
downloadnewspipe-f1af56fb0f5b6e42b87cb6f1145cf8773b3f46b4.tar.gz
newspipe-f1af56fb0f5b6e42b87cb6f1145cf8773b3f46b4.tar.bz2
newspipe-f1af56fb0f5b6e42b87cb6f1145cf8773b3f46b4.zip
Improvement of the Flask redirection for the view mark_as_read().
-rw-r--r--pyaggr3g470r/views.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index ee163099..e44f0f28 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -89,6 +89,10 @@ def logout():
flash("Logged out successfully.", 'success')
return redirect(url_for('home'))
+def redirect_url(default='index'):
+ return request.args.get('next') or \
+ request.referrer or \
+ url_for(default)
@@ -192,9 +196,14 @@ def mark_as_read(feed_id=None):
for article in unread_articles:
article.readed = True
article.save()
+ flash('Articles of the feed "' + feed.title + '" marked as read.', 'info')
+ break
+ else:
+ flash("This feed do not exist.", 'warning')
else:
models.Article.objects(readed=False).update(set__readed=True)
- return redirect(url_for('home'))
+ flash("All articles marked as read", 'info')
+ return redirect(redirect_url())
@app.route('/like/<article_id>', methods=['GET'])
@login_required
bgstack15