Show More
@@ -15,6 +15,7 b' from boards.mdx_neboard import bbcode_ex' | |||||
15 | from boards.models import PostImage |
|
15 | from boards.models import PostImage | |
16 | from boards.models.base import Viewable |
|
16 | from boards.models.base import Viewable | |
17 | from boards.utils import datetime_to_epoch, cached_result |
|
17 | from boards.utils import datetime_to_epoch, cached_result | |
|
18 | import boards.models.thread | |||
18 |
|
19 | |||
19 |
|
20 | |||
20 | WS_NOTIFICATION_TYPE_NEW_POST = 'new_post' |
|
21 | WS_NOTIFICATION_TYPE_NEW_POST = 'new_post' | |
@@ -75,8 +76,8 b' class PostManager(models.Manager):' | |||||
75 |
|
76 | |||
76 | posting_time = timezone.now() |
|
77 | posting_time = timezone.now() | |
77 | if not thread: |
|
78 | if not thread: | |
78 |
thread = Thread.objects.create( |
|
79 | thread = boards.models.thread.Thread.objects.create( | |
79 |
|
|
80 | bump_time=posting_time, last_edit_time=posting_time) | |
80 | new_thread = True |
|
81 | new_thread = True | |
81 | else: |
|
82 | else: | |
82 | new_thread = False |
|
83 | new_thread = False | |
@@ -113,7 +114,7 b' class PostManager(models.Manager):' | |||||
113 | list(map(thread.add_tag, tags)) |
|
114 | list(map(thread.add_tag, tags)) | |
114 |
|
115 | |||
115 | if new_thread: |
|
116 | if new_thread: | |
116 | Thread.objects.process_oldest_threads() |
|
117 | boards.models.thread.Thread.objects.process_oldest_threads() | |
117 | else: |
|
118 | else: | |
118 | thread.bump() |
|
119 | thread.bump() | |
119 | thread.last_edit_time = posting_time |
|
120 | thread.last_edit_time = posting_time |
@@ -176,7 +176,7 b' class Thread(models.Model):' | |||||
176 | Deletes thread with all replies. |
|
176 | Deletes thread with all replies. | |
177 | """ |
|
177 | """ | |
178 |
|
178 | |||
179 | for reply in self.replies.all(): |
|
179 | for reply in self.get_replies().all(): | |
180 | reply.delete() |
|
180 | reply.delete() | |
181 |
|
181 | |||
182 | super(Thread, self).delete(using) |
|
182 | super(Thread, self).delete(using) |
@@ -76,7 +76,7 b' class PostTests(TestCase):' | |||||
76 |
|
76 | |||
77 | thread = opening_post.get_thread() |
|
77 | thread = opening_post.get_thread() | |
78 |
|
78 | |||
79 | self.assertEqual(3, thread.replies.count()) |
|
79 | self.assertEqual(3, thread.get_replies().count()) | |
80 |
|
80 | |||
81 | def test_create_post_with_tag(self): |
|
81 | def test_create_post_with_tag(self): | |
82 | """Test adding tag to post""" |
|
82 | """Test adding tag to post""" |
General Comments 0
You need to be logged in to leave comments.
Login now