with transaction.atomic(): #开启事物 select_for_update() 加锁 obj = models.Enrollment.objects.filter(pk=1).select_for_update() obj.update(why_us='呵呵呵。。')