def get(self, name): node = Node.query.filter_by(name=name).first_or_404() p = self.get_argument('p', 1) pagination = Topic.query.filter_by(node_id=node.id)\ .order_by('-last_reply_time').paginate(p, 30) pagination.items = get_full_topics(pagination.items) self.render('node/show_node.html', node=node, pagination=pagination)
def render(self): topics = Topic.query.filter_by().order_by('-last_reply_time').limit(20).all() topics = get_full_topics(topics) return self.render_string('front/front_recent_topics.html', topics=topics)