diff --git a/taiga/projects/attachments/api.py b/taiga/projects/attachments/api.py index d306f27a..aded41aa 100644 --- a/taiga/projects/attachments/api.py +++ b/taiga/projects/attachments/api.py @@ -58,6 +58,12 @@ class BaseAttachmentViewSet(HistoryResourceMixin, WatchedResourceMixin, ModelCru super().pre_save(obj) + def post_delete(self, obj): + # NOTE: When destroy an attachment, the content_object change + # after and not before + self.persist_history_snapshot(obj, delete=True) + super().pre_delete(obj) + def get_object_for_snapshot(self, obj): return obj.content_object