def tag(tag_id): tag = Tag.cache(tag_id) post_ids = PostTag.query.filter_by(tag_id=tag_id).order_by( PostTag.post_id.desc()).with_entities(PostTag.post_id).all() posts = Post.get_multi(post_ids) return render_template('tag.html', tag=tag, posts=posts)