diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index 0cab685..770e073 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -1184,10 +1184,10 @@ class Event(models.Model): events.sort(key=lambda e: e.imported_date, reverse=True) return events[0] - def update(self, other): + def update(self, other, all): # set attributes - for attr in Event.data_fields(): + for attr in Event.data_fields(all=all): setattr(self, attr, getattr(other, attr)) # adjust modified date if required @@ -1236,12 +1236,13 @@ class Event(models.Model): if len(same_events) != 0: # check if one event has been imported and not modified in this list same_imported = Event.find_last_pure_import(same_events) - + pure = True # if not, we check if it does not match exactly with another if not same_imported: for e in same_events: if event.similar(e, False): same_imported = e + pure = False break if same_imported: @@ -1253,7 +1254,7 @@ class Event(models.Model): same_imported.other_versions.representative = None same_imported.other_versions.save() - same_imported.update(event) + same_imported.update(event, pure) # we only update all tags if it"s a pure import same_imported.set_in_importation_process() same_imported.prepare_save() to_update.append(same_imported)