Show More
@@ -314,6 +314,11 class Post(models.Model, Viewable): | |||||
314 | if image_refs_count == 1: |
|
314 | if image_refs_count == 1: | |
315 | image.delete() |
|
315 | image.delete() | |
316 |
|
316 | |||
|
317 | for attachment in self.attachments.all(): | |||
|
318 | attachment_refs_count = Post.objects.filter(attachments__in=[attachment]).count() | |||
|
319 | if attachment_refs_count == 1: | |||
|
320 | attachment.delete() | |||
|
321 | ||||
317 | thread = self.get_thread() |
|
322 | thread = self.get_thread() | |
318 | thread.last_edit_time = timezone.now() |
|
323 | thread.last_edit_time = timezone.now() | |
319 | thread.save() |
|
324 | thread.save() |
General Comments 0
You need to be logged in to leave comments.
Login now