From d74be5dcb515d8546b74c22444a4ab547777b7ae Mon Sep 17 00:00:00 2001 From: Olivier Leger Date: Wed, 4 Oct 2023 14:59:41 -0400 Subject: [PATCH] Retrive xform out of the transaction --- onadata/apps/logger/signals.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/onadata/apps/logger/signals.py b/onadata/apps/logger/signals.py index f5861037c..263e6cf62 100644 --- a/onadata/apps/logger/signals.py +++ b/onadata/apps/logger/signals.py @@ -78,9 +78,9 @@ def post_save_attachment(instance, created, **kwargs): if not file_size: return - with transaction.atomic(): - xform = attachment.instance.xform + xform = attachment.instance.xform + with transaction.atomic(): UserProfile.objects.filter(user_id=xform.user_id).update( attachment_storage_bytes=F('attachment_storage_bytes') + file_size )