aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r
diff options
context:
space:
mode:
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r--pyaggr3g470r/views.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index ee163099..80dd203c 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)
@@ -114,7 +118,7 @@ def fetch(feed_id=None):
feed_getter = feedgetter.FeedGetter(g.user.email)
feed_getter.retrieve_feed(feed_id)
flash("New articles retrieved.", 'success')
- return redirect(url_for('home'))
+ return redirect(redirect_url())
@app.route('/about/', methods=['GET'])
@login_required
@@ -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