Skip to content

Commit 90b1563

Browse files
committed
Safe fallbacks
1 parent 5727080 commit 90b1563

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

form_designer/models.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,12 @@ def loader(submission, field, choice_dict):
182182
value = submission.data[field.name]
183183
elif (old := field._old_name) is not None and old in submission.data:
184184
value = submission.data[old]
185-
return choice_dict.get(value, value)
185+
try:
186+
if isinstance(value, list):
187+
return [choice_dict.get(v, v) for v in value]
188+
return choice_dict.get(value, value)
189+
except TypeError: # unhashable types or other, unexpected circumstances
190+
return value
186191

187192
def old_name_loader(submission, old_name):
188193
return submission.data.get(old_name)

0 commit comments

Comments
 (0)