models.py 文件源码

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

项目:django-user-tasks 作者: edx 项目源码 文件源码
def increment_total_steps(self, steps):
        """Increase the value of :py:attr:`total_steps` by the given number and save."""
        # Assume that other processes may be making concurrent changes
        UserTaskStatus.objects.filter(pk=self.id).update(total_steps=F('total_steps') + steps, modified=now())
        self.refresh_from_db(fields={'total_steps', 'modified'})
        if self.parent:
            self.parent.increment_total_steps(steps)  # pylint: disable=no-member
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号