Skip to content

Commit a37d931

Browse files
committed
handle no existing data for other calls
1 parent 3d28b88 commit a37d931

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

hypha/apply/funds/models/mixins.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,16 @@ def process_file_data(self, data, latest_existing_data=None):
9999
for field in self.form_fields:
100100
if isinstance(field.block, UploadableMediaBlock):
101101
new_file = data.get(field.id, [])
102-
existing_file = latest_existing_data.get(field.id, [])
102+
if latest_existing_data:
103+
existing_file = latest_existing_data.get(field.id, [])
104+
else:
105+
existing_file = None
103106

104107
# processing files before checking because placeholder files can't be read
105108
new_stream_file = self.process_file(self, field, new_file)
106-
# existing_stream_file = self.process_file(self, field, existing_file)
107109

108110
# save only if it is not the same file(s)
109-
same_file = self._is_same_file(existing_file, new_stream_file)
110-
if not same_file:
111+
if not self._is_same_file(existing_file, new_stream_file):
111112
try:
112113
new_stream_file.save()
113114
except (AttributeError, FileNotFoundError):

0 commit comments

Comments
 (0)