[Answered ]-Django commit 2 transactions at the same time

2👍

You should be able to control transactions explicitly using transaction.atomic

from django.db import transaction

def viewfunc(request):

    with transaction.atomic():
        skill_1 = Skill.object.get(position=3)
        skill_2 = Skill.object.get(position=4)
        skill_1.position = 4
        skill_2.position = 3
        skill_1.save()
        skill_2.save()

Leave a comment