[web2py] Re: Get the ID of the just inserted row

2011-12-23 Thread Thomas Dall'Agnese
Hi Anthony, Thanks for your answer. I used the form.vars.id way. And indeed, I had to change my process because the form.process().acceptedwas false after doing a form.validate(). So I changed the form.validate() with form.process().accepted and delete the inserted post if an exception is rais

[web2py] Re: Get the ID of the just inserted row

2011-12-23 Thread Anthony
You have two options -- you can let the .process() method handle the insert, in which case the record id will be in form.vars.id after that, or you can do the insert manually, in which case the id will be returned by the .insert() method (i.e., id = db.post.insert(**dict(form.vars))). Note, I d

Re: [web2py] Re: Get the ID of the just inserted row

2011-12-23 Thread Thomas Dall'Agnese
Thanks for your prompt response. Best Regards, Thomas Sent from Android On Dec 23, 2011 5:02 PM, "lyn2py" wrote: > Use form.vars.id to get the id of the new record inserted > > More about it here: > http://web2py.com/books/default/chapter/29/7#SQLFORM > (search form.vars.id to get to the parag

[web2py] Re: Get the ID of the just inserted row

2011-12-23 Thread lyn2py
Use form.vars.id to get the id of the new record inserted More about it here: http://web2py.com/books/default/chapter/29/7#SQLFORM (search form.vars.id to get to the paragraph concerned) On Dec 23, 3:01 pm, Thomas Dall'Agnese wrote: > Hi, > > Let say I have 2 tables: > > db.define_table('post',