From 343bd272e9aba641ae0d5d84614a90f3dd41fcb8 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Sat, 16 Dec 2023 14:21:16 +0800 Subject: [PATCH] Add default empty string value to remarks and description fields --- equipment_tracker/equipments/serializers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/equipment_tracker/equipments/serializers.py b/equipment_tracker/equipments/serializers.py index 889834b..d87ea2d 100644 --- a/equipment_tracker/equipments/serializers.py +++ b/equipment_tracker/equipments/serializers.py @@ -64,7 +64,8 @@ class EquipmentLogSerializer(serializers.HyperlinkedModelSerializer): format="%m-%d-%Y %I:%M%p", read_only=True) last_updated_by = serializers.SerializerMethodField() name = serializers.CharField() - description = serializers.CharField(required=False, allow_blank=True) + description = serializers.CharField( + required=False, allow_blank=True, default="") history = EquipmentHistoricalRecordField() class Meta: @@ -98,7 +99,8 @@ class EquipmentInstanceSerializer(serializers.HyperlinkedModelSerializer): category = serializers.CharField( source='equipment.category', read_only=True) status = serializers.CharField() - remarks = serializers.CharField(required=False, allow_blank=True) + remarks = serializers.CharField( + required=False, allow_blank=True, default="") date_added = serializers.DateTimeField( format="%m-%d-%Y %I:%M%p", read_only=True) last_updated = serializers.DateTimeField(