I'm running into a strange issue that a TemporaryUploadedFile is not JSON Serializable. I'm confident that this is caused by a file slipping into the context (and not being able to serialize it), but I can't figure out how it's happening. This is more or less my code:
for k,v in form.cleaned_data.items()
is_file = (check the input_type of the key on the form field to see if this should be a file)
if is_file:
if value is not None:
for file in value:
(Upload the file to S3 storage)
if only one file:
request.session[k] = file.name
else:
request.session[k] = f"{count} files"
else:
request.session[k] =
else:
request.session[k] = v
Based on this, I feel like either file.name is somehow sometimes coming back with the file itself, or is_file is sometimes coming back as false. Has anyone else seen this?