I have, among various other fields, a boolean field like below in my models.py:
is_searchable = models.BooleanField(default=True)
When using PUT request to modify either of the fields of the model, value of is_searchable
changes to False
even if nothing related to it is specified in the PUT request.
I am using serializers.ModelSerializer
here. Version of django rest framework - 3.0.1
If you don't want to update is_searchable you have to define it as read_only field in your serializer class.
Eg:
class YourSerializer(serializers.ModelSerializer):
is_searchable = serializers.BooleanField(read_only=True)
otherwise, pass the correct value true/false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With