diff --git a/anchor/models/fields/single_attachment.py b/anchor/models/fields/single_attachment.py index fcf2e78..3b8a06e 100644 --- a/anchor/models/fields/single_attachment.py +++ b/anchor/models/fields/single_attachment.py @@ -31,11 +31,13 @@ def __get__(self, *args, **kwargs) -> Attachment | None: def __set__(self, instance, value): if isinstance(value, Attachment): - value.object_id = instance.id - value.content_type = ContentType.objects.get_for_model(instance) - value.name = self.name - value.order = 0 - value.save() + if value._state.adding: + value.object_id = instance.id + value.content_type = ContentType.objects.get_for_model(instance) + value.name = self.name + value.order = 0 + value.save() + return if isinstance(value, Blob):