本文整理汇总了Python中misago.threads.models.Thread.last_post方法的典型用法代码示例。如果您正苦于以下问题:Python Thread.last_post方法的具体用法?Python Thread.last_post怎么用?Python Thread.last_post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类misago.threads.models.Thread
的用法示例。
在下文中一共展示了Thread.last_post方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_merge
# 需要导入模块: from misago.threads.models import Thread [as 别名]
# 或者: from misago.threads.models.Thread import last_post [as 别名]
def test_merge(self):
"""merge(other_thread) moves other thread content to this thread"""
with self.assertRaises(ValueError):
self.thread.merge(self.thread)
datetime = timezone.now() + timedelta(5)
other_thread = Thread(
category=self.category,
started_on=datetime,
starter_name='Tester',
starter_slug='tester',
last_post_on=datetime,
last_poster_name='Tester',
last_poster_slug='tester',
)
other_thread.set_title("Other thread")
other_thread.save()
post = Post.objects.create(
category=self.category,
thread=other_thread,
poster_name='Admin',
poster_ip='127.0.0.1',
original="Hello! I am other message!",
parsed="<p>Hello! I am other message!</p>",
checksum="nope",
posted_on=datetime,
updated_on=datetime,
)
other_thread.first_post = post
other_thread.last_post = post
other_thread.save()
self.thread.merge(other_thread)
self.thread.synchronize()
self.assertEqual(self.thread.replies, 1)
self.assertEqual(self.thread.last_post, post)
self.assertEqual(self.thread.last_post_on, post.posted_on)
self.assertEqual(self.thread.last_poster_name, "Admin")
self.assertEqual(self.thread.last_poster_slug, "admin")