on utilise la date fournie par le json comme date de dernière modification

This commit is contained in:
Jean-Marie Favreau 2023-12-30 13:44:38 +01:00
parent 159e47dff3
commit 8e6622c178

View File

@ -251,6 +251,7 @@ class Event(models.Model):
self.created_date = now self.created_date = now
if hasattr(self, "require_imported_date"): if hasattr(self, "require_imported_date"):
self.imported_date = now self.imported_date = now
if not hasattr(self, "require_imported_date") or self.modified_date is None:
self.modified_date = now self.modified_date = now
@ -294,10 +295,10 @@ class Event(models.Model):
del event_structure["url_human"] del event_structure["url_human"]
if "last_modified" in event_structure and event_structure["last_modified"] is not None: if "last_modified" in event_structure and event_structure["last_modified"] is not None:
event_structure["created_date"] = event_structure["last_modified"] event_structure["modified_date"] = event_structure["last_modified"]
del event_structure["last_modified"] del event_structure["last_modified"]
else: else:
event_structure["created_date"] = timezone.now() event_structure["created_date"] = None
if "start_time" in event_structure: if "start_time" in event_structure:
event_structure["start_time"] = time.fromisoformat(event_structure["start_time"]) event_structure["start_time"] = time.fromisoformat(event_structure["start_time"])