From cc84536e2acc2a68cfca13b66d7bd3b84d44edfc Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 5 Aug 2011 16:12:17 +0200 Subject: [PATCH 1/1] concurrency: no model save at file save in tasks --- apps/archive/tasks.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/archive/tasks.py b/apps/archive/tasks.py index e257da0..27b6d00 100755 --- a/apps/archive/tasks.py +++ b/apps/archive/tasks.py @@ -47,10 +47,14 @@ class AudioFormatTask(Task): @classmethod def save(cls, audiobook, file_name): - getattr(audiobook, "%s_file" % cls.ext).save( + field = "%s_file" % cls.ext + getattr(audiobook, field).save( "%d.%s" % (audiobook.pk, cls.ext), - ExistingFile(file_name) + ExistingFile(file_name), + save=False ) + Audiobook.objects.filter(pk=audiobook.pk).update( + **{field: getattr(audiobook, field)}) @classmethod def published(cls, audiobook): -- 2.20.1