From a8026d74ee2cea04999f11243da684d7d6e9b4f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Fri, 22 Aug 2014 12:03:36 +0200 Subject: [PATCH] Fix #745: Generate the historical entry of attachments affter deletions instead before --- taiga/projects/attachments/api.py | 6 ++++++ 1 file changed, 6 insertions(+) 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