diff --git a/boards/models/post/__init__.py b/boards/models/post/__init__.py --- a/boards/models/post/__init__.py +++ b/boards/models/post/__init__.py @@ -314,6 +314,11 @@ class Post(models.Model, Viewable): if image_refs_count == 1: image.delete() + for attachment in self.attachments.all(): + attachment_refs_count = Post.objects.filter(attachments__in=[attachment]).count() + if attachment_refs_count == 1: + attachment.delete() + thread = self.get_thread() thread.last_edit_time = timezone.now() thread.save()