diff --git a/boards/models.py b/boards/models.py --- a/boards/models.py +++ b/boards/models.py @@ -48,7 +48,7 @@ class PostManager(models.Manager): def exists(self, post_id): posts = Post.objects.filter(id = post_id) - return len(posts) == 0 + return len(posts) > 0 def is_admin(self, user, passw): return Admins.objects.filter(name = user, password = passw) is not None diff --git a/boards/tests.py b/boards/tests.py --- a/boards/tests.py +++ b/boards/tests.py @@ -22,7 +22,7 @@ class BoardTests(TestCase): Post.objects.delete_post(post) - self.assertTrue(Post.objects.exists(post_id)) + self.assertTrue(not Post.objects.exists(post_id)) def test_delete_posts_by_ip(self): post = self.create_post() @@ -30,4 +30,4 @@ class BoardTests(TestCase): Post.objects.delete_posts_by_ip('0.0.0.0') - self.assertTrue(Post.objects.exists(post_id)) + self.assertTrue(not Post.objects.exists(post_id))