drf-writable-nested
drf-writable-nested copied to clipboard
[Question] Nested partial update with non-nullable fields.
I have something like:
class A(models.Model):
x = models.IntegerField()
y = models.IntegerField(default=0)
class B(models.Model):
z = models.IntegerField()
a = models.ForeignKey(A)
class BUpdateAPIView(UpdateAPIView):
serializer_class = BUpdateSerializer
...
class AUpdateSerializer(ModelSerializer):
class Meta:
model = B
fields = ('y', )
class BUpdateSerializer(WritableNestedModelSerializer):
a = AUpdateSerializer()
class Meta:
model = B
fields = ('z', 'a', )
And I'm trying to do a partial update (using method PATCH) on B, but it fails because x = null
Hello @DanielAviv! The partial data updating isn't implemented well for nested serializers. I created an issue about it #79.