def get_context_data(self, **kwargs): context = super(Topics, self).get_context_data(**kwargs) context["title"] = FORUM_NAME context["category"] = "topics" context["forum_path"] = FORUM_PATH topics = PhpbbTopics.objects.order_by('-topic_time')[:10] latest = [] for topic in topics: post = PhpbbPosts.objects.get(post_id=topic.topic_first_post_id) latest.append(( topic.topic_first_poster_name, unquote(topic.topic_title), phpbb_to_html(post.post_text), FORUM_PATH + "viewtopic.php?t=%s" % topic.topic_id, )) context["latest"] = latest return context
def get_context_data(self, **kwargs): context = super(Posts, self).get_context_data(**kwargs) context["title"] = FORUM_NAME context["category"] = "posts" context["forum_path"] = FORUM_PATH posts = PhpbbPosts.objects.order_by('-post_time')[:20] latest = [] for post in posts: latest.append(( get_username(post.poster_id).username, unquote(post.post_subject), phpbb_to_html(post.post_text), FORUM_PATH + "viewtopic.php?p=%s#p%s" % (post.post_id, post.post_id), )) context["latest"] = latest return context
def item_title(self, item): return unquote(item.post_subject)