dbutils.py 文件源码

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

项目:beg-django-e-commerce 作者: Apress 项目源码 文件源码
def cleanup_relations(instance, **kwargs):
    if getattr(instance, '__handling_delete', False):
        return
    rels_seen, to_delete, to_put = get_cleanup_entities(instance)
    _get_included_cleanup_entities((instance,), rels_seen, to_delete, to_put)
    for entity in [instance] + to_delete:
        entity.__handling_delete = True
    if to_delete:
        db.delete(to_delete)
    for entity in [instance] + to_delete:
        del entity.__handling_delete
    if to_put:
        db.put(to_put)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号