From 27be31298e77ba2a6ed6bf8ee021a7ca8b0a4b2d Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Fri, 25 Aug 2023 15:50:48 +0530 Subject: [PATCH] Set edits as read_only, exclude asset from Service (#1561) * Set edits as read_only, exclude asset from Service * allow blank note --- care/facility/api/serializers/asset.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/care/facility/api/serializers/asset.py b/care/facility/api/serializers/asset.py index 1af4927845..e9a15ce881 100644 --- a/care/facility/api/serializers/asset.py +++ b/care/facility/api/serializers/asset.py @@ -83,11 +83,11 @@ class Meta: class AssetServiceSerializer(ModelSerializer): id = UUIDField(source="external_id", read_only=True) - edits = AssetServiceEditSerializer(many=True) + edits = AssetServiceEditSerializer(many=True, read_only=True) class Meta: model = AssetService - exclude = ("deleted",) + exclude = ("deleted", "asset") def update(self, instance, validated_data): user = self.context["request"].user @@ -119,7 +119,7 @@ class AssetSerializer(ModelSerializer): location = UUIDField(write_only=True, required=True) last_service = AssetServiceSerializer(read_only=True) last_serviced_on = serializers.DateField(write_only=True, required=False) - note = serializers.CharField(write_only=True, required=False) + note = serializers.CharField(write_only=True, required=False, allow_blank=True) class Meta: model = Asset