forked from 0x2620/pandora
avoid transaction.atomic insided of transaction.atomic
This commit is contained in:
parent
5cfe392e22
commit
af65750363
2 changed files with 13 additions and 11 deletions
|
@ -4,6 +4,7 @@ from glob import glob
|
|||
|
||||
from celery.task import task
|
||||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
from django.db.models import Q
|
||||
|
||||
from item.models import Item
|
||||
|
@ -248,6 +249,7 @@ def move_media(data, user):
|
|||
if old_item and old_item.files.count() == 0 and i.files.count() == len(data['ids']):
|
||||
for a in old_item.annotations.all().order_by('id'):
|
||||
a.item = i
|
||||
with transaction.atomic():
|
||||
a.set_public_id()
|
||||
Annotation.objects.filter(id=a.id).update(item=i, public_id=a.public_id)
|
||||
old_item.clips.all().update(item=i, sort=i.sort)
|
||||
|
|
|
@ -478,6 +478,7 @@ class Item(models.Model):
|
|||
|
||||
for a in self.annotations.all().order_by('id'):
|
||||
a.item = other
|
||||
with transaction.atomic():
|
||||
a.set_public_id()
|
||||
Annotation.objects.filter(id=a.id).update(item=other, public_id=a.public_id)
|
||||
try:
|
||||
|
@ -1910,7 +1911,6 @@ class AnnotationSequence(models.Model):
|
|||
|
||||
@classmethod
|
||||
def nextid(cls, item):
|
||||
with transaction.atomic():
|
||||
s, created = cls.objects.get_or_create(item=item)
|
||||
if created:
|
||||
nextid = s.value
|
||||
|
|
Loading…
Reference in a new issue