I found what I need here:
http://dev.s-cubism.com/plugin_comment_cascade
Thank you all.
On Tuesday, March 6, 2012 8:34:35 AM UTC-3, Ale wrote:
>
> Good morning everyone. I am making a simple application, but I'm running
> into some doubt. I wanted to do something like thefacebook posts .. Where I
> have a site that I put a post, listed below are all posts with the option
> to comment on them. So far so good .. But how to write the data's comment
> in a post post correct? Attached I am sending the screen of my application,
> I think it is easier to visualize what I wanted. Transmission also Model
> / View / Controller. If you can help me will be grateful.
>
> I'd have to get the id of the post via ajax?
>
> My model:
>
> Post = db.define_table('post',
> Field('title'),
> Field('post'),
> format="%(title)s"
> )
>
> Comment = db.define_table('comment',
> Field('post', 'reference post'),
> Field('comment')
> )
>
> My Controller
>
> def index():
> form = SQLFORM(Post,
> formstyle="divs",
> submit_button="Postar").process()
>
> form2 = SQLFORM.factory(
> Field('comment', requires=IS_NOT_EMPTY()),
> formstyle="divs",
> submit_button="Comentar")
> if form2.process().accepted:
> print request.vars
> print request.args
> response.flash = 'form accepted'
> elif form2.errors:
> response.flash = 'form has errors'
> else:
> response.flash = 'please fill out the form'
>
>
> posts = db().select(Post.ALL)
> return dict(form=form, form2=form2, posts=posts)
>
>
> my view:
>
> <div class="post">
> {{=form.custom.begin}}
> <p>Title</p>
> {{=form.custom.widget.title}}
> <p>Post</p>
> {{=form.custom.widget.post}}
> {{=form.custom.submit}}
> {{=form.custom.end}}
> </div>
> <div class="posts">
> {{for post in posts:}}
> <li class="posts" id=post_{{=post.id}}>
> <p>{{=post.post}}</p>
> <p>{{=post.id}}
> <div class="comment">
> {{=form2.custom.begin}}
> {{=form2.custom.widget.comment}}
> {{=form2.custom.submit}}
> {{=form2.custom.end}}
> </div>
> </li>
> {{pass}}
> </div>
>