Re: When do I have to call save() on a Model Instance?

2015-01-30 Thread Erik Cederstrand
> Den 29/01/2015 kl. 19.40 skrev Tobias Dacoir : > > Thanks for answering all my questions. > > So it's perfectly save to call the save method at a later time? As long as I > keep the object and a pointer to it in memory I can freely modify it in > several Functions before

Re: When do I have to call save() on a Model Instance?

2015-01-29 Thread Vijay Khemlani
yep, it's safe to do so On Thu, Jan 29, 2015 at 3:40 PM, Tobias Dacoir wrote: > Thanks for answering all my questions. > > So it's perfectly save to call the save method at a later time? As long as > I keep the object and a pointer to it in memory I can freely modify it in >

Re: When do I have to call save() on a Model Instance?

2015-01-29 Thread Tobias Dacoir
Thanks for answering all my questions. So it's perfectly save to call the save method at a later time? As long as I keep the object and a pointer to it in memory I can freely modify it in several Functions before finally calling save at some point in time? -- You received this message because

Re: When do I have to call save() on a Model Instance?

2015-01-29 Thread Vijay Khemlani
You could pass the user as an optional parameter to function2. Whether you should save the user or not in each of the methods depends on the logic of your application, or you can add a parameter to the method (True to save the object, False otherwise) On Thu, Jan 29, 2015 at 1:43 PM, Tobias

When do I have to call save() on a Model Instance?

2015-01-29 Thread Tobias Dacoir
I want to reduce the database queries, imagine I have a case like this: def function1(): user = User.objects.get(id=1) user.name ="Myself" function2() function3(user) user.save() def function2(): user = User.objects.get(id=1) user.lastname = "private" def