Below is my sample model:
class DemoModel(models.Model):
field_one = models.IntegerField()
field_two = models.IntegerField(blank=True, null=True)
The Serializer:
class DemoSerializer(serializers.ModelSerializer):
"""
Here only field_one should be creatable and only field_two should be updatable
"""
class Meta:
model = models.DemoModel
fields = '__all__'
My question is how can I write the view for this serializer and model, so that when using the post method the client can not add data for the field_two field. Client can only add data to field_one. But while updating, the client can update the value of field_two, but can not update the value of field_one field.