blog.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:akamatsu 作者: rmed 项目源码 文件源码
def tagged(tag, page=1):
    """Display posts tagged with the given tag.

    Args:
        tag (str): Tag name.
        page (int): Listing page number to show.
    """
    posts = (
        Post.query
        .filter(Post.tags.any(name=tag))
        .filter_by(is_published=True, ghost='')
        .order_by(Post.timestamp.desc())
        .paginate(page, 10, False)
    )

    try:
        return render_theme('blog/tagged.html', posts=posts, tag=tag)

    except NotFound:
        # Show a 'no posts found' notice instead of a 404 error
        return render_theme('blog/tagged.html', tag=tag)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号