Friday, January 30, 2015

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

> 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 finally calling save at some point in time?

This depends on your requirements. If there's a chance that another thread has modified the same object in the database from the time you fetch the data and until you call save(), then it's not necessarily safe. This would depend on your use of transactions, whether the data has been submitted from a form etc.

You should audit your code for these things if race conditions are a concern to you.


You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment