Fix #745: Generate the historical entry of attachments affter deletions instead before

remotes/origin/enhancement/email-actions
David Barragán Merino 2014-08-22 12:03:36 +02:00
parent 22ff3500a1
commit a8026d74ee
1 changed files with 6 additions and 0 deletions

View File

@ -58,6 +58,12 @@ class BaseAttachmentViewSet(HistoryResourceMixin, WatchedResourceMixin, ModelCru
super().pre_save(obj) 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): def get_object_for_snapshot(self, obj):
return obj.content_object return obj.content_object