From d6585562e9d914bf5f147e080240d29971d73a7f Mon Sep 17 00:00:00 2001 From: WinnyTroy Date: Thu, 6 Feb 2020 11:27:46 +0300 Subject: [PATCH] Include filter when fetching attachments for a specific submission --- onadata/apps/logger/models/instance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onadata/apps/logger/models/instance.py b/onadata/apps/logger/models/instance.py index 4b3ca0a515..c4a07e81b7 100644 --- a/onadata/apps/logger/models/instance.py +++ b/onadata/apps/logger/models/instance.py @@ -66,7 +66,7 @@ def get_attachment_url(attachment, suffix=None): def _get_attachments_from_instance(instance): attachments = [] - for a in instance.attachments.all(): + for a in instance.attachments.filter(deleted_at__isnull=True): attachment = dict() attachment['download_url'] = get_attachment_url(a) attachment['small_download_url'] = get_attachment_url(a, 'small')