handler.py 文件源码

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

项目:Ushio 作者: Hanaasagi 项目源码 文件源码
def get(self):
        uid = self.current_user['_id']
        limit = 20
        page = int(self.get_query_argument('page', '1'))
        fav_list = yield self.db.user.find_one({
            '_id': ObjectId(uid)
        }, {
            'favorite': 1
        })

        cursor = self.db.topic.find({
            '_id': {
                '$in': fav_list['favorite']
            }
        })
        total = yield cursor.count()
        cursor.limit(
            limit).skip((page - 1) * limit)
        topics = yield cursor.to_list(length=limit)
        self.render('topic/template/topic-favorite.html',
                    topics=topics, page=page, limit=limit, total=total)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号