models.py 文件源码

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

项目:mutant 作者: peterdemin 项目源码 文件源码
def update_ancestor(sender, instance, **kwargs):
    if kwargs['created'] or not kwargs['update_fields'] or 'parent' in kwargs['update_fields']:
        ancestor_or_self = instance.recursive_ancestor_or_self()
        if instance.ancestor_or_self != ancestor_or_self:
            FundingInstitution.objects.filter(id=instance.id).update(
                ancestor_or_self=ancestor_or_self
            )
        if not kwargs['raw']:
            for child in instance.fundinginstitution_set.all():
                post_save.send(
                    sender=sender,
                    instance=child,
                    raw=kwargs['raw'],
                    created=kwargs['created'],
                    using=kwargs['using'],
                    update_fields=kwargs['update_fields'],
                )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号