def atomic(fn):
 @functools.wraps(fn)
 @write
 def inner(*args, **kwargs):
  cursor = connection.cursor()
  cursor.execute('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE')
  with transaction.atomic():
   return fn(*args, **kwargs)
 inner.non_atomic = fn
 return inner

def atomic ( fn ) : @ functools . wraps ( fn ) @ write def inner ( * args , ** kwargs ) : cursor = connection . cursor ( ) cursor . execute ( 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE' ) with transaction . atomic ( ) : return fn ( * args , ** kwargs ) inner . non_atomic = fn return inner
set the transaction isolation level to serializable and then delegate to transaction .