Re: model.save() lifecycle

2009-03-21 Thread chefsmart
> Does that answer your question? Yes Malcolm, thanks. I was trying to follow the call path to where Django asks the DB for the id. I'm new to Python, so I guess that's how I got lost. Thanks for the help. Regards. On Mar 21, 2:32 pm, Malcolm Tredinnick wrote: > On Sat, 2009-03-21 at 00:17 -0

Re: model.save() lifecycle

2009-03-21 Thread Malcolm Tredinnick
On Sat, 2009-03-21 at 00:17 -0700, chefsmart wrote: [...] > After calling save() on the model, we see that "Now it has an ID". > > So Django is doing an SQL select query, something like last_insert_id, > if I'm not wrong? That's correct. It varies for each database backend as to which SQL we exe

model.save() lifecycle

2009-03-21 Thread chefsmart
The Django tutorial says in Part 1: [_Begin Quote_] # Create a new Poll. >>> import datetime >>> p = Poll(question="What's up?", pub_date=datetime.datetime.now()) # Save the object into the database. You have to call save() explicitly. >>> p.save() # Now it has an ID. Note that this might say "