I have a model \'MyModel\' with many fields and I would like to update a field \'status\' using PATCH method. I\'m using class based views. Is there any way to implement PAT
If anyone is still planning to find a simple solution using ModelSerializer
without changing much of your views, you can subclass the ModelSerializer
and have all your ModelSerializer
s inherit from that.
class PatchModelSerializer(serializers.ModelSerializer):
def __init__(self, *args, **kwargs):
kwargs['partial'] = True
super(PatchModelSerializer, self).__init__(*args, **kwargs)
class ArticleSerializer(PatchModelSerializer):
class Meta:
model = Article