##// END OF EJS Templates
Actually delete the opening post when deleting the thread
neko259 -
r884:e3087995 default
parent child Browse files
Show More
@@ -368,7 +368,7 b' class Post(models.Model, Viewable):'
368 thread.last_edit_time = timezone.now()
368 thread.last_edit_time = timezone.now()
369 thread.save()
369 thread.save()
370
370
371 super(Post, self).delete(using)
371 super(Post, self).delete(using)
372
372
373 logging.getLogger('boards.post.delete').info(
373 logging.getLogger('boards.post.delete').info(
374 'Deleted post P#{}/{}'.format(self.id, self.get_title()))
374 'Deleted post P#{}/{}'.format(self.id, self.get_title()))
@@ -37,9 +37,12 b' class PostTests(TestCase):'
37 thread = opening_post.get_thread()
37 thread = opening_post.get_thread()
38 reply = Post.objects.create_post("", "", thread=thread)
38 reply = Post.objects.create_post("", "", thread=thread)
39
39
40 thread.delete()
40 opening_post.delete()
41
41
42 self.assertFalse(Post.objects.filter(id=reply.id).exists())
42 self.assertFalse(Post.objects.filter(id=reply.id).exists(),
43 'Reply was not deleted with the thread.')
44 self.assertFalse(Post.objects.filter(id=opening_post.id).exists(),
45 'Opening post was not deleted with the thread.')
43
46
44 def test_post_to_thread(self):
47 def test_post_to_thread(self):
45 """Test adding post to a thread"""
48 """Test adding post to a thread"""
General Comments 0
You need to be logged in to leave comments. Login now