2👍
✅
Once you have validated the doc_type_value
you are not setting it back into the upload
object, you need to update the upload
object:
for upload in uploads:
data = upload.data
updated_members = []
for member in data['members']:
try:
doc_type_value = member['info'].get('documentType')
except KeyError:
pass
else:
if doc_type_value == 'NATIONAL ID':
doc_type_value = 'NATIONAL ID Card'
member['info']['documentType'] = doc_type_value
updated_members.append(member)
data['members'] = updated_members
upload.data = data
upload.save()
Source:stackexchange.com