##// END OF EJS Templates
Check post-images and post-attachments relations by related name
neko259 -
r1281:643e4c1d default
parent child Browse files
Show More
@@ -310,12 +310,12 b' class Post(models.Model, Viewable):'
310 310 """
311 311
312 312 for image in self.images.all():
313 image_refs_count = Post.objects.filter(images__in=[image]).count()
313 image_refs_count = image.post_images.count()
314 314 if image_refs_count == 1:
315 315 image.delete()
316 316
317 317 for attachment in self.attachments.all():
318 attachment_refs_count = Post.objects.filter(attachments__in=[attachment]).count()
318 attachment_refs_count = attachment.attachment_posts.count()
319 319 if attachment_refs_count == 1:
320 320 attachment.delete()
321 321
General Comments 0
You need to be logged in to leave comments. Login now