From 5f527be4f06d0d5f4540b09a3e703073815900b7 Mon Sep 17 00:00:00 2001 From: Roman <72063601+folix-01@users.noreply.github.com> Date: Fri, 20 Sep 2024 11:55:51 +0200 Subject: [PATCH] Return Bando.apertura_bando as null if had been set default(1100-01-01T00:00:00). (#281) Co-authored-by: Roman Kysil --- CHANGES.rst | 4 ++-- .../plone/contenttypes/restapi/serializers/summary.py | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 3605c138..3d4c2997 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,8 +5,8 @@ Changelog 5.1.16 (unreleased) ------------------- -- Nothing changed yet. - +- Return Bando.apertura_bando as null if had been set default("1100-01-01T00:00:00"). + [folix-01] 5.1.15 (2024-09-16) ------------------- diff --git a/src/design/plone/contenttypes/restapi/serializers/summary.py b/src/design/plone/contenttypes/restapi/serializers/summary.py index 4d326f6b..bb5a1e94 100644 --- a/src/design/plone/contenttypes/restapi/serializers/summary.py +++ b/src/design/plone/contenttypes/restapi/serializers/summary.py @@ -27,6 +27,14 @@ def __call__(self, force_all_metadata=False): if "bando_state" in metadata_fields or self.show_all_metadata_fields: res["bando_state"] = self.get_bando_state() + # if default set to None + if ( + "apertura_bando" in metadata_fields + or self.show_all_metadata_fields + and res["apertura_bando"] == "1100-01-01T00:00:00" + ): + res["apertura_bando"] = None + if "geolocation" in metadata_fields or self.show_all_metadata_fields: # backward compatibility for some block templates if "geolocation" not in res: