models.py 文件源码

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

项目:sndlatr 作者: Schibum 项目源码 文件源码
def query_display(cls, user_id, delta_minutes=60):
        """
        Query all jobs that have state scheduled, queued or sent (but not done)
        OR are done and have been scheduled for no longer than delta_minutes
        ago.
        """
        shortly_ago = datetime.datetime.utcnow() - datetime.timedelta(
            minutes=delta_minutes)

        # query all jobs that are
        return cls.query(ndb.OR(cls.state.IN(['scheduled', 'queued', 'sent']),
                                ndb.AND(cls.scheduled_at >= shortly_ago,
                                        cls.state == 'done')),
                         cls.user_id == user_id)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号