[Fixed]-Django Rest-Framework Serializer: KeyError thrown on field that certainly exists

1👍

Somehow, you are returning {‘value’: value} from the validate instead of {‘name’: value} and this will confuse DRF.

Edit:
If you really need value instead of name, you also need to add the source argument to the field:

name = serializers.CharField(source='value', max_length=255)

It may already be translated to value in the validate’s data, not dead sure about.

Leave a comment