本文整理匯總了Python中web.controllers.ArticleController.previous_article方法的典型用法代碼示例。如果您正苦於以下問題:Python ArticleController.previous_article方法的具體用法?Python ArticleController.previous_article怎麽用?Python ArticleController.previous_article使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類web.controllers.ArticleController
的用法示例。
在下文中一共展示了ArticleController.previous_article方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: article
# 需要導入模塊: from web.controllers import ArticleController [as 別名]
# 或者: from web.controllers.ArticleController import previous_article [as 別名]
def article(article_id=None):
"""
Presents the content of an article.
"""
article = ArticleController(g.user.id).get(id=article_id)
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_titles=[clear_string(article.title)],
article=article,
previous_article=previous_article,
next_article=next_article)