3👍
✅
You can explicitly define type
field inside serializer, and use source
argument to map it to msg_type
field:
class TruRouteRequestSerializer(serializers.ModelSerializer):
type = serializers.CharField(source='msg_type')
class Meta:
model = TruRouteRequest
fields = ['type', ...]
Source:stackexchange.com