From 769c607550b8a6233483ba86419bfcf1a55de1fc Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Sat, 23 Nov 2024 00:01:46 +0100 Subject: [PATCH] =?UTF-8?q?On=20met=20=C3=A0=20jour=20les=20sources=20d'im?= =?UTF-8?q?portation,=20car=20dans=20le=20cas=20o=C3=B9=20un=20=C3=A9v?= =?UTF-8?q?=C3=A9nement=20a=20=C3=A9t=C3=A9=20import=C3=A9=20ind=C3=A9pend?= =?UTF-8?q?amment=20auparavant,=20on=20veut=20aussi=20qu'il=20soit=20assoc?= =?UTF-8?q?i=C3=A9=20malgr=C3=A9=20tout=20=C3=A0=20l'importation=20r=C3=A9?= =?UTF-8?q?currente.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/agenda_culturel/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index 1439adb..d529e99 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -1372,6 +1372,11 @@ class Event(models.Model): if uuid not in self.uuids: self.uuids.append(uuid) + # add possible missing sources + for source in other.import_sources: + if source not in self.import_sources: + self.import_sources.append(source) + # Limitation: the given events should not be considered similar one to another... def import_events(events, remove_missing_from_source=None): @@ -1462,7 +1467,7 @@ class Event(models.Model): nb_updated = Event.objects.bulk_update( to_update, fields=Event.data_fields(no_m2m=True) - + ["imported_date", "modified_date", "uuids", "status"], + + ["imported_date", "modified_date", "uuids", "status", "import_sources"], ) nb_draft = 0