##// END OF EJS Templates
Fixed "exists" method.
neko259 -
r10:051499a0 default
parent child Browse files
Show More
@@ -48,7 +48,7 b' class PostManager(models.Manager):'
48 def exists(self, post_id):
48 def exists(self, post_id):
49 posts = Post.objects.filter(id = post_id)
49 posts = Post.objects.filter(id = post_id)
50
50
51 return len(posts) == 0
51 return len(posts) > 0
52
52
53 def is_admin(self, user, passw):
53 def is_admin(self, user, passw):
54 return Admins.objects.filter(name = user, password = passw) is not None
54 return Admins.objects.filter(name = user, password = passw) is not None
@@ -22,7 +22,7 b' class BoardTests(TestCase):'
22
22
23 Post.objects.delete_post(post)
23 Post.objects.delete_post(post)
24
24
25 self.assertTrue(Post.objects.exists(post_id))
25 self.assertTrue(not Post.objects.exists(post_id))
26
26
27 def test_delete_posts_by_ip(self):
27 def test_delete_posts_by_ip(self):
28 post = self.create_post()
28 post = self.create_post()
@@ -30,4 +30,4 b' class BoardTests(TestCase):'
30
30
31 Post.objects.delete_posts_by_ip('0.0.0.0')
31 Post.objects.delete_posts_by_ip('0.0.0.0')
32
32
33 self.assertTrue(Post.objects.exists(post_id))
33 self.assertTrue(not Post.objects.exists(post_id))
General Comments 0
You need to be logged in to leave comments. Login now