当前位置: 首页>>代码示例>>Python>>正文


Python Post.get_lastest方法代码示例

本文整理汇总了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)
开发者ID:brenden17,项目名称:blog,代码行数:28,代码来源:main.py

示例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)
开发者ID:brenden17,项目名称:blog,代码行数:11,代码来源:main.py

示例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)
开发者ID:brenden17,项目名称:blog,代码行数:11,代码来源:main.py

示例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)
开发者ID:brenden17,项目名称:blog,代码行数:24,代码来源:main.py

示例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)
开发者ID:brenden17,项目名称:blog,代码行数:6,代码来源:main.py

示例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)
开发者ID:brenden17,项目名称:blog,代码行数:5,代码来源:main.py

示例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)
开发者ID:brenden17,项目名称:blog,代码行数:5,代码来源:main.py

示例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)
开发者ID:brenden17,项目名称:blog,代码行数:8,代码来源:main.py

示例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)
开发者ID:brenden17,项目名称:blog,代码行数:8,代码来源:main.py


注:本文中的models.Post.get_lastest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。