Re: Modify .save() implementation

2012-12-16 Thread Anssi Kääriäinen
On 13 joulu, 22:11, Emil Stenström wrote: > I just thinking out loud here but: what if another thread does something to > the previously loaded object? I'm not sure if Django has concurrency tests > build into the test suite, but if it hasn't it could explain why the code > is written as it is. I

Re: Modify .save() implementation

2012-12-13 Thread Emil Stenström
I just thinking out loud here but: what if another thread does something to the previously loaded object? I'm not sure if Django has concurrency tests build into the test suite, but if it hasn't it could explain why the code is written as it is. On Friday, 30 November 2012 19:53:32 UTC+1, Anssi

Modify .save() implementation

2012-11-30 Thread Anssi Kääriäinen
I would like to change the implementation of .save(). In the following case: s = SomeModel.objects.get(pk=somepk) s.somefield = val s.save() we currently do this: SELECT (from .get()) SELECT (from .save()) UPDATE The second SELECT is redundant. We have knowledge that the model was loaded from t