__init__.py 文件源码

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

项目:JmilkFan-s-Blog 作者: JmilkFan 项目源码 文件源码
def sidebar_data():
    """Set the sidebar function."""

    # Get post of recent
    recent = db.session.query(Post).order_by(
            Post.publish_date.desc()
        ).limit(5).all()

    # Get the tags and sort by count of posts.
    top_tags = db.session.query(
            Tag, func.count(posts_tags.c.post_id).label('total')
        ).join(
            posts_tags
        ).group_by(Tag).order_by('total DESC').limit(5).all()
    return recent, top_tags


# Use the Blueprint object to set the Route URL
# Register the view function into blueprint
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号