aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyaggr3g470r/views.py')
-rw-r--r--pyaggr3g470r/views.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 491d44a2..6d2a3b99 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -243,7 +243,17 @@ def article(article_id=None):
if not article.readed:
article.readed = True
db.session.commit()
- return render_template('article.html', head_title=utils.clear_string(article.title), article=article)
+
+ previous_article = article.previous_article()
+ if previous_article is None:
+ previous_article = article.source.articles[0]
+ next_article = article.next_article()
+ if next_article is None:
+ next_article = article.source.articles[-1]
+
+ return render_template('article.html', head_title=utils.clear_string(article.title),
+ article=article,
+ previous_article=previous_article, next_article=next_article)
flash("This article do not exist.", 'warning')
return redirect(redirect_url())
bgstack15