From 0a2bcfd8b336a815024180e4889bcb9619a3a638 Mon Sep 17 00:00:00 2001 From: Robin Vanhove Date: Fri, 24 Apr 2020 13:54:31 +0200 Subject: [PATCH] Hide download ZIP file button if no files are present --- wagtailstreamforms/templates/streamforms/index_submissions.html | 2 ++ wagtailstreamforms/views/submission_list.py | 1 + 2 files changed, 3 insertions(+) diff --git a/wagtailstreamforms/templates/streamforms/index_submissions.html b/wagtailstreamforms/templates/streamforms/index_submissions.html index d698f322..4201dfc1 100644 --- a/wagtailstreamforms/templates/streamforms/index_submissions.html +++ b/wagtailstreamforms/templates/streamforms/index_submissions.html @@ -89,9 +89,11 @@

+ {% if contains_files %}
+ {% endif %} diff --git a/wagtailstreamforms/views/submission_list.py b/wagtailstreamforms/views/submission_list.py index 6f27312a..bf8fed45 100644 --- a/wagtailstreamforms/views/submission_list.py +++ b/wagtailstreamforms/views/submission_list.py @@ -128,6 +128,7 @@ def get_context_data(self, **kwargs): "has_delete_permission": self.permission_helper.user_can_delete_obj( self.request.user, self.object ), + "contains_files": FormSubmissionFile.objects.filter(submission__form=self.object).count() > 0 } )