Hi, Let say I have 2 tables:
db.define_table('post', Field('content')) db.define_table('comment', Field('content'), Field('post', 'reference post)) When I add a "post" (through a FORM), I would like to automatically add 3 comments that refer to that post. How can I retrieve the ID of the just inserted post and add the comments referring to it? Currently, I handle to form to add a post like this: def add_post(): form = SQLFORM(db.post) if form.validate(): try: comments = generateAutoComments() except Exception, e: response.flash = "Errors generating comments (%s)" % e.message else: if form.process().accepted: # I guess here I would like to add all the comments to that just added post? response.flash = 'Post added!' return locals()