• Django深入----django.db.transaction


    django 的事务:

    transaction.py

    atomic---原子性
    复制代码
    def atomic(using=None, savepoint=True):
        # Bare decorator: @atomic -- although the first argument is called
        # `using`, it's actually the function being decorated.
        if callable(using):
            return Atomic(DEFAULT_DB_ALIAS, savepoint)(using)
        # Decorator: @atomic(...) or context manager: with atomic(...): ...
        else:
            return Atomic(using, savepoint)
    复制代码

    调用:

        @tx.atomic
        @model_pk_lock
        def update(self, request, *args, **kwargs):
  • 相关阅读:
    OSU!

    旅行
    序列
    致摸鱼两千年后的你
    生成函数
    小x游世界树

    画画
    OSU!
  • 原文地址:https://www.cnblogs.com/bayueman/p/6628786.html
Copyright © 2020-2023  润新知