Format last updated field properly to add space between actual time and AM/PM indicator

This commit is contained in:
Keannu Bernasol 2023-12-16 15:47:03 +08:00
parent 9e16bda918
commit 938614fafa

View file

@ -16,9 +16,9 @@ class EquipmentHistoricalRecordField(serializers.ListField):
class EquipmentSerializer(serializers.HyperlinkedModelSerializer):
date_added = serializers.DateTimeField(
format="%m-%d-%Y %I:%M%p", read_only=True)
format="%m-%d-%Y %I:%M %p", read_only=True)
last_updated = serializers.DateTimeField(
format="%m-%d-%Y %I:%M%p", read_only=True)
format="%m-%d-%Y %I:%M %p", read_only=True)
last_updated_by = serializers.SerializerMethodField()
name = serializers.CharField()
description = serializers.CharField(
@ -67,7 +67,7 @@ class EquipmentSerializer(serializers.HyperlinkedModelSerializer):
class EquipmentLogsSerializer(serializers.HyperlinkedModelSerializer):
history_date = serializers.DateTimeField(
format="%m-%d-%Y %I:%M%p", read_only=True)
format="%m-%d-%Y %I:%M %p", read_only=True)
history_user = serializers.SerializerMethodField()
class Meta:
@ -84,9 +84,9 @@ class EquipmentLogsSerializer(serializers.HyperlinkedModelSerializer):
class EquipmentLogSerializer(serializers.HyperlinkedModelSerializer):
date_added = serializers.DateTimeField(
format="%m-%d-%Y %I:%M%p", read_only=True)
format="%m-%d-%Y %I:%M %p", read_only=True)
last_updated = serializers.DateTimeField(
format="%m-%d-%Y %I:%M%p", read_only=True)
format="%m-%d-%Y %I:%M %p", read_only=True)
last_updated_by = serializers.SerializerMethodField()
name = serializers.CharField()
description = serializers.CharField(required=False)
@ -126,9 +126,9 @@ class EquipmentInstanceSerializer(serializers.HyperlinkedModelSerializer):
remarks = serializers.CharField(
max_length=512, required=False, allow_blank=True)
date_added = serializers.DateTimeField(
format="%m-%d-%Y %I:%M%p", read_only=True)
format="%m-%d-%Y %I:%M %p", read_only=True)
last_updated = serializers.DateTimeField(
format="%m-%d-%Y %I:%M%p", read_only=True)
format="%m-%d-%Y %I:%M %p", read_only=True)
last_updated_by = serializers.SerializerMethodField()
status = serializers.ChoiceField(
choices=EquipmentInstance.EQUIPMENT_INSTANCE_STATUS_CHOICES)
@ -202,7 +202,7 @@ class EquipmentInstanceSerializer(serializers.HyperlinkedModelSerializer):
class EquipmentInstanceLogsSerializer(serializers.HyperlinkedModelSerializer):
history_date = serializers.DateTimeField(
format="%m-%d-%Y %I:%M%p", read_only=True)
format="%m-%d-%Y %I:%M %p", read_only=True)
history_user = serializers.SerializerMethodField()
equipment = serializers.SlugRelatedField(
slug_field='id', queryset=Equipment.objects.all())
@ -231,9 +231,9 @@ class EquipmentInstanceLogSerializer(serializers.HyperlinkedModelSerializer):
status = serializers.CharField()
remarks = serializers.CharField()
date_added = serializers.DateTimeField(
format="%m-%d-%Y %I:%M%p", read_only=True)
format="%m-%d-%Y %I:%M %p", read_only=True)
last_updated = serializers.DateTimeField(
format="%m-%d-%Y %I:%M%p", read_only=True)
format="%m-%d-%Y %I:%M %p", read_only=True)
last_updated_by = serializers.SerializerMethodField()
history = EquipmentInstanceHistoricalRecordField()
category = serializers.CharField(