def show_all_posts(): posts = Post.view("Post/all") resp = "" for post in posts: resp += "<li>" + \ "<div id='post_box'>" + \ "<a href='http://"+post._id+"' id='anchor_post_content'>" + \ post.content + \ "</a>" + \ "<p id='para_post_author'> Submitted by: " +\ "<a href='/user/"+post.author+"' id='anchor_post_author'>" + \ post.author + \ "</a>" + \ "</p>" + \ "<a href='/post/"+post._id+"/comments' id='anchor_post_comments'>" + \ str(count_comments(post._id)) + " comments" + \ "</a>" + \ "</div>" + \ "</li>" post_list = "<ul id='post_list'>" + resp + "</ul>" return post_list
def user_home(name): user_id = "a9514e98427c8e708c00960e431f1afc" newpost = Post(author_id=user_id, content="Fish", date=datetime.utcnow()) newpost.save() posts = Post.view('Post/all') resp = "" for post in posts: if post.author == name: resp += "<li>" + post.content + "</li>" resp += "<li>" + post.author + "</li>" return render_template("index.html", posts=posts)
def user_home(name): user_id="a9514e98427c8e708c00960e431f1afc" newpost=Post( author_id = user_id, content="Fish", date=datetime.utcnow() ) newpost.save() posts = Post.view('Post/all') resp = "" for post in posts: if post.author == name: resp += "<li>" + post.content + "</li>" resp += "<li>" + post.author + "</li>" return render_template("index.html", posts=posts)
def index_setting(): posts = Post.view('Post/all') return "list all post" post_list = "<ul>" + resp + "</ul>" return post_list