Beispiel #1
0
def view_post(id):
    form = request.forms
    if form.update_comment :
        post = Post.get(id=id)
        comment = Comment()
        comment.post = post # current post
        comment.user = User.get(username=form.username)
        comment.content = form.content
        comment.pub_date = datetime.now()
        comment.save()
        redirect('/view/post/%d' %(id,))
    else :
        post = Post.get(id=id)
        comments = Comment.filter(post__id = id)
        return template('templates/post.html.tpl',post=post,comments=comments)