models.py 文件源码

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

项目:cocreate 作者: ngageoint 项目源码 文件源码
def unreadForUser(self, user_id):
        from django.db import connection
        cursor = connection.cursor()
        cursor.execute("SELECT n.id, n.added_at, n.owner_id, n.read, n.msg, n.related_model_type, n.related_model_id, n.progress, n.object_name, n.error FROM cocreate_notification n WHERE n.owner_id = ? and n.read = 0", (user_id,))
        result_list = []

        for row in cursor.fetchall():
            p = self.model(
                id = row[0],
                added_at = row[1],
                owner_id = row[2],
                read = row[3],
                msg = row[4],
                related_model_type = row[5],
                related_model_id = row[6],
                progress = row[7],
                object_name = row[8],
                error = row[9]
            )
            result_list.append(p)
        return result_list
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号