I want to build simple reddit site, so I have defined posts and comments,
each comment has to have post_id as a reference.
So when I create SQFORM how can I insert post id in that form, i tried like
this
def newComment():
form = SQLFORM(db.comment).process(next=URL('default/show',request.args
(0)))
form.vars.post_id = request.args(0,cast=int)
return dict(form=form)
but when I iterate over all comments from this post the comments dont show
up, here is the query for comments
comments = db(db.comment.post_id==request.args(0,cast=int)).select()
Also I dont want users to see this post_id field, so I turned on this
feature in the database definition
db.comment.post_id.readable = db.comment.post_id.writable = False
If I dont specify writable to false the user can select which post he wants
I dont want that.
So how can I use SQLFROM in this case, create an SQLFORM which has a
reference to post_id so when I submit the comment it will show up as a
comment on this post?
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.