本文整理汇总了Python中models.Article.get_article_for_day_with_slug方法的典型用法代码示例。如果您正苦于以下问题:Python Article.get_article_for_day_with_slug方法的具体用法?Python Article.get_article_for_day_with_slug怎么用?Python Article.get_article_for_day_with_slug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Article
的用法示例。
在下文中一共展示了Article.get_article_for_day_with_slug方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Article [as 别名]
# 或者: from models.Article import get_article_for_day_with_slug [as 别名]
def get(self, year, month, day, slug_title):
year = dec(year)
month = dec(month)
day = dec(day)
today = datetime.utcnow()
articles = [Article.get_article_for_day_with_slug(year, month, day, slug_title)]
logging.info(articles)
response = render_template('blog.html',
year_list=models.BLOG_YEAR_LIST,
month_list=models.MONTH_LIST,
current_year=today.year,
current_month=today.month,
articles=articles,
show_comments=True)
self.response.out.write(response)
"""auth_level = self.is_user_authorized()
示例2: get
# 需要导入模块: from models import Article [as 别名]
# 或者: from models.Article import get_article_for_day_with_slug [as 别名]
def get(self, year, month, day, slug_title):
auth_level = self.is_user_authorized()
if auth_level == models.AUTH_LEVEL_REGISTERED_USER:
self.redirect("/account/activate/reminder/")
elif auth_level == models.AUTH_LEVEL_ACTIVATED_USER:
year = dec(year)
month = dec(month)
day = dec(day)
today = datetime.utcnow()
articles = [Article.get_article_for_day_with_slug(year, month, day, slug_title)]
logging.info(articles)
response = render_template(
"blog.html",
year_list=models.BLOG_YEAR_LIST,
month_list=models.MONTH_LIST,
current_year=today.year,
current_month=today.month,
articles=articles,
)
self.response.out.write(response)
else:
response = render_template("index.html")
self.response.out.write(response)