Fix #745: Generate the historical entry of attachments affter deletions instead before
parent
22ff3500a1
commit
a8026d74ee
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue