本文整理汇总了Python中models.Post.get_lastest方法的典型用法代码示例。如果您正苦于以下问题:Python Post.get_lastest方法的具体用法?Python Post.get_lastest怎么用?Python Post.get_lastest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Post
的用法示例。
在下文中一共展示了Post.get_lastest方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import get_lastest [as 别名]
def post(title=None, category=None):
if title:
post = Post.query(Post.title==title).get()
else:
post = Post.get_1lastest(category=category)
if not post:
return redirect(url_for("notfound", title=title))
pre_post = post.get_pre(category=category)
next_post = post.get_next(category=category)
content, toc = md2html(post.content)
last_posts = Post.get_lastest()
txt = noTag(noTag(toc, 'div'), 'ul')
toc = toc if txt.strip() else ''
return render_template('post.html',
post=post,
last_posts=last_posts,
category=category,
pre_post=pre_post,
next_post=next_post,
toc=toc,
content=content)
示例2: network
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import get_lastest [as 别名]
def network():
entities = Entity.query().order(Entity.name)
result = list()
for e in entities:
result.extend(e.get_json())
last_posts = Post.get_lastest()
return render_template('network.html',
last_posts=last_posts,
result=result)
示例3: idonotknow
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import get_lastest [as 别名]
def idonotknow(noun):
posts = Post.query().filter(Post.category.IN([noun])).order(-Post.date)
tagged_posts = Post.get_tagged_post(noun)
last_posts = Post.get_lastest()
return render_template('idonotknow.html',
noun=noun,
posts=posts,
last_posts=last_posts,
tagged_posts=tagged_posts)
示例4: entity
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import get_lastest [as 别名]
def entity(noun=None):
entity = Entity.query(Entity.name==noun).get()
post = Post.query(Post.title==noun).get()
if not post:
return redirect(url_for("idonotknow", noun=noun))
posts = Post.query().filter(Post.category.IN([noun])).order(-Post.date)
tagged_posts = Post.get_tagged_post(noun)
content, toc = md2html(post.content)
txt = noTag(noTag(toc, 'div'), 'ul')
toc = toc if txt.strip() else ''
last_posts = Post.get_lastest()
return render_template('entity.html',
entity=entity,
post=post,
posts=posts,
tagged_posts=tagged_posts,
last_posts=last_posts,
toc=toc,
content=content)
示例5: notfound
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import get_lastest [as 别名]
def notfound(title=None):
last_posts = Post.get_lastest()
return render_template('notfound.html', suggest=title,
last_posts=last_posts)
示例6: admin
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import get_lastest [as 别名]
def admin():
last_posts = Post.get_lastest()
return render_template('admin.html',last_posts=last_posts)
示例7: about
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import get_lastest [as 别名]
def about():
last_posts = Post.get_lastest()
return render_template('about.html',last_posts=last_posts)
示例8: hisotry
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import get_lastest [as 别名]
def hisotry():
posts = Post.query().order(-Post.date)
last_posts = Post.get_lastest()
return render_template('archives-history.html',
last_posts=last_posts,
posts=posts)
示例9: archives
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import get_lastest [as 别名]
def archives():
entities = Entity.query().order(Entity.name)
last_posts = Post.get_lastest()
return render_template('archives.html',
last_posts=last_posts,
entities=entities)