Re: last insert id

2006-04-20 Thread Adrian Holovaty
On 4/18/06, Mathieu Blondel <[EMAIL PROTECTED]> wrote: > When one saves an object with the save() method, a common need is to > get the id corresponding to the row that has just been inserted. > > p = polls.Poll(...) > p.save() > p.id # is set to None > > So here are two possible solutions, > 1)

Re: last insert id

2006-04-19 Thread [EMAIL PROTECTED]
Strange, for me it works like said in 1). After the new object is saved, the id field is not None, but the true id of the object in database. Maybe I did not understand something? Also, if you look at the tutorial at http://www.djangoproject.com/documentation/tutorial1/ it says: # No polls are

last insert id

2006-04-18 Thread Mathieu Blondel
Hi, I'm a new comer to Django so please forgive me if the following has already a solution. When one saves an object with the save() method, a common need is to get the id corresponding to the row that has just been inserted. p = polls.Poll(...) p.save() p.id # is set to None So here are two