diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index 554b523..b98d19f 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -1481,12 +1481,15 @@ class Event(models.Model): # check if we need to clean the other_versions if ( not clone + and not "noclean_other_versions" in kwargs and self.pk and self.other_versions is not None and self.other_versions.nb_duplicated() == 1 ): self.other_versions.delete() self.other_versions = None + if "noclean_other_versions" in kwargs: + del kwargs["noclean_other_versions"] # first save the current object super().save(*args, **kwargs) @@ -2042,7 +2045,7 @@ class Event(models.Model): or new_image ): same_imported.download_image() - same_imported.save(update_fields=["local_image"]) + same_imported.save(update_fields=["local_image"], noclean_other_versions=True) to_update.append(same_imported) else: