views.py 文件源码

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

项目:Flask_Blog 作者: sugarguo 项目源码 文件源码
def index():
    site_info = site_get()
    article_id = request.args.get('article_id',0)
    article_dict = []
    temp_dict = {}
    packet_dict = {}
    packet_list = Packet.query.filter_by().all()
    if packet_list is not None:
        for temp in packet_list:
            temp_dict = temp.__dict__
            del temp_dict["_sa_instance_state"]
            packet_dict[str(temp_dict['id'])] = temp_dict['packet_name']

    tempdict = {}
    article_list = Article.query.filter_by(show = 1).all()
    if article_list is not None:
        for temp in article_list:
            tempdict = temp.__dict__
            article_dict.append([tempdict["id"],tempdict["title"],tempdict["timestamp"].strftime('%Y-%m-%d'),tempdict["body"][:150]])

    return render_template('index.html', **locals())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号