From: Radek Czajka Date: Fri, 5 Aug 2011 14:12:17 +0000 (+0200) Subject: concurrency: no model save at file save in tasks X-Git-Url: https://git.mdrn.pl/audio.git/commitdiff_plain/cc84536e2acc2a68cfca13b66d7bd3b84d44edfc concurrency: no model save at file save in tasks --- 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):