wrap adding many clips in transaction, should be faster
This commit is contained in:
parent
545710528e
commit
58e787efd7
1 changed files with 16 additions and 14 deletions
|
@ -48,6 +48,7 @@ def addClips(request):
|
||||||
clips = []
|
clips = []
|
||||||
if edit.editable(request.user):
|
if edit.editable(request.user):
|
||||||
index = data.get('index', edit.clips.count())
|
index = data.get('index', edit.clips.count())
|
||||||
|
with transaction.commit_on_success():
|
||||||
for c in data['clips']:
|
for c in data['clips']:
|
||||||
clip = edit.add_clip(c, index)
|
clip = edit.add_clip(c, index)
|
||||||
index += 1
|
index += 1
|
||||||
|
@ -253,6 +254,7 @@ def addEdit(request):
|
||||||
|
|
||||||
if 'clips' in data and edit.type == 'static':
|
if 'clips' in data and edit.type == 'static':
|
||||||
index = 0
|
index = 0
|
||||||
|
with transaction.commit_on_success():
|
||||||
for c in data['clips']:
|
for c in data['clips']:
|
||||||
clip = edit.add_clip(c, index)
|
clip = edit.add_clip(c, index)
|
||||||
index += 1
|
index += 1
|
||||||
|
|
Loading…
Reference in a new issue