# HG changeset patch # User neko259 # Date 2013-03-24 08:24:10 # Node ID 051499a084f30121bd686071ec8acce3d6911587 # Parent f67fe28f5c7591e870d9c0da72e3e13746557d5a Fixed "exists" method. 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))