1👍
You can set write or read only in extra_kwargs in the Meta class of a serializer.
E.g.
class PurchaseSerializer(serializers.ModelSerializer):
class Meta:
model = Purchase
fields = "__all__"
extra_kwargs = {
'field_1': {'write_only': True},
'field...N': {'write_only': True},
'id': {'read_only': True}
}
Source:stackexchange.com