From 54a1b0742baa816167ac7611fd61b416d36b2c88 Mon Sep 17 00:00:00 2001
From: Fredrik Jonsson <frjo@xdeb.org>
Date: Fri, 28 Sep 2018 11:42:30 +0200
Subject: [PATCH] Avoid a object is not iterable error in is_initial() when
 submitting new form.

---
 opentech/apply/stream_forms/fields.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/opentech/apply/stream_forms/fields.py b/opentech/apply/stream_forms/fields.py
index 6f542f221..efc205118 100644
--- a/opentech/apply/stream_forms/fields.py
+++ b/opentech/apply/stream_forms/fields.py
@@ -18,9 +18,12 @@ class MultiFileInput(ClearableFileInput):
 
     def is_initial(self, value):
         is_initial = super().is_initial
-        return all(
-            is_initial(file) for file in value
-        )
+        try:
+            return all(
+                is_initial(file) for file in value
+            )
+        except TypeError:
+            return is_initial(value)
 
     def render(self, name, value, attrs=dict()):
         if self.multiple:
-- 
GitLab