1👍
✅
You should specify read_only=True
to mark the field as readonly. By customizing it yourself, you prevented Django from doing this itself:
class OrderSerializer(serializers.ModelSerializer):
orderId = serializers.UUIDField(source='id', read_only=True)
orderName = serializers.CharField(source='name')
class Meta:
model = Order
fields = (
'orderId',
'orderName',
)
read_only_fields = ('orderId',)
Source:stackexchange.com