3👍
You can change the name
field in the ModelSerializer
to username
.
example:
class CustomSerializer(serializers.ModelSerializer):
username = serializers.CharField(source='name')
class Meta:
model = ...
fields = ('username', ...)
Now in validation errors it will have the key username
instead.
Source:stackexchange.com