From faa72867c51a5dcb1a3a6f6994f44cfb0c4c88a9 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Mon, 10 Mar 2025 18:54:59 +0100 Subject: [PATCH] On accepte les heures de fin avec une chaine nulle ('') Fix #358 --- src/agenda_culturel/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index 1d90539..f3de32e 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -1592,15 +1592,19 @@ class Event(models.Model): else: event_structure["modified_date"] = None - if "start_time" in event_structure: + if "start_time" in event_structure and event_structure["start_time"] != "": event_structure["start_time"] = time.fromisoformat( event_structure["start_time"] ) + else: + event_structure["start_time"] = None - if "end_time" in event_structure: + if "end_time" in event_structure and event_structure["end_time"] != "": event_structure["end_time"] = time.fromisoformat( event_structure["end_time"] ) + else: + event_structure["end_time"] = None if "location" not in event_structure or event_structure["location"] is None: event_structure["location"] = ""