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
1 changed files with 4 additions and 3 deletions

View File

@ -251,7 +251,8 @@ class Event(models.Model):
self.created_date = now
if hasattr(self, "require_imported_date"):
self.imported_date = now
self.modified_date = now
if not hasattr(self, "require_imported_date") or self.modified_date is None:
self.modified_date = now
def prepare_save(self):
@ -294,10 +295,10 @@ class Event(models.Model):
del event_structure["url_human"]
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"]
else:
event_structure["created_date"] = timezone.now()
event_structure["created_date"] = None
if "start_time" in event_structure:
event_structure["start_time"] = time.fromisoformat(event_structure["start_time"])