Hiya, friend of mine and I are pretty stumped about a nested fields error, we're getting the following:```AssertionError: The `.update()` method does not support writable nested fields by default. Write an explicit `.update()` method for serializer `documents.serialisers.DocumentSerializer`, or set `read_only=True` on nested serializer fields.``` but what is confusing is that there already is an update method. See the code below, really appreciate any thoughts.``````class DocumentSerializer(OwnedObjectSerializer, DynamicFieldsModelSerializer):...custom_fields = CustomFieldInstanceSerializer(many=True, allow_null=True)...def update(self, instance, validated_data):...super().update(instance, validated_data)return instancedef __init__(self, *args, **kwargs):self.truncate_content = kwargs.pop("truncate_content", False)super().__init__(*args, **kwargs)class Meta:model = Documentdepth = 1fields = ("id","correspondent","document_type","storage_path","title","content","tags","created","created_date","modified","added","archive_serial_number","original_file_name","archived_file_name","owner","permissions","user_can_change","set_permissions","notes","custom_fields",)```class CustomFieldSerializer(serializers.ModelSerializer):class Meta:model = CustomFieldfields = ["id","name","data_type",]``````class CustomFieldInstanceSerializer(serializers.ModelSerializer):parent = CustomFieldSerializer()value = SerializerMethodField()def get_value(self, obj: CustomFieldInstance):return obj.valuedef create(self, validated_data):parent_data = validated_data.pop("parent")parent = CustomField.objects.get(id=parent_data["id"])instance = CustomFieldInstance.objects.create(parent=parent)return instancedef update(self, instance: CustomFieldInstance):return instanceclass Meta:model = CustomFieldInstancefields = ["parent","value",]```--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/32ac3ee1-292d-4a82-9243-3790f1fb0538n%40googlegroups.com.