use some transactions

This commit is contained in:
j 2011-10-29 16:59:12 +02:00
parent 88b4d9f62f
commit 21ab5fa451

View file

@ -13,7 +13,7 @@ import uuid
import unicodedata
from urllib import quote
from django.db import models
from django.db import models, transaction
from django.db.models import Count, Q, Sum
from django.core.files.base import ContentFile
from django.conf import settings
@ -518,6 +518,7 @@ class Item(models.Model):
else:
ItemFind.objects.filter(item=self, key=key).delete()
with transaction.commit_on_success():
for key in settings.CONFIG['itemKeys']:
i = key['id']
if i == 'title':
@ -1043,6 +1044,7 @@ class Item(models.Model):
return icon
def load_subtitles(self):
with transaction.commit_on_success():
layer = Layer.objects.get(name='subtitles')
Annotation.objects.filter(layer=layer,item=self).delete()
offset = 0