def blog(): post_id = request.args.get('post') tag = request.args.get('tag') if post_id: post = Post.find_one(post_id) if not post: abort(404) post.render() return render_template("blog-page.html", user = user, post = post) elif tag: posts = Post.find_by_tag(tag) return render_template("blog.html", user = user, posts = posts) else: post_idx = request.args.get('page') or 0 posts = Post.all() return render_template("blog.html", user= user, posts = posts)
def testPostModel(): assert len(Post.all()) >= 0 p = Post.all()[0] print p.strfdate print p.metafname