From 50468b210b25bde109cb13b3d29cc974735117bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Wed, 3 Apr 2024 18:05:16 -0300 Subject: [PATCH] =?UTF-8?q?Data=20verifica=C3=A7=C3=A3o=20como=20data,=20n?= =?UTF-8?q?=C3=A3o=20como=20timestamp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/casas/serializers.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sigi/apps/casas/serializers.py b/sigi/apps/casas/serializers.py index 71050e3..f9bcf5c 100644 --- a/sigi/apps/casas/serializers.py +++ b/sigi/apps/casas/serializers.py @@ -68,6 +68,9 @@ class ServicoSerializer(serializers.ModelSerializer): read_only=True, slug_field="nome" ) url = serializers.SerializerMethodField("get_url") + data_verificacao = serializers.SerializerMethodField( + "get_data_verificacao" + ) resultado_verificacao = serializers.SerializerMethodField( "get_resultado_verificacao" ) @@ -91,6 +94,11 @@ class ServicoSerializer(serializers.ModelSerializer): else: return f"http://{ obj.url }" + def get_data_verificacao(self, obj): + if obj.data_verificacao: + return obj.data_verificacao.date() + return None + def get_resultado_verificacao(self, obj): return obj.get_resultado_verificacao_display()