Open mitar opened 12 years ago
I was thinking that it shouldnt be harmful to return obj
hence the original path, but I can see your point.
Have you got an example where it breaks things for you?
Here is an example where this is needed.
The main idea is, that if you add to object some custom attributes, which are not in the schema, you expect them to be there afterwards. But they are not. So something like this:
obj = Person.objects.all()[0]
obj._foo = 'bar'
val = obj.reload()
self.assertEqual(val._foo, 'bar')
In upper example, authentication caches which backend was used in user object, so this is lost on reload.
Document's
reload
should returnself
and notobj
, as obj is just a temporary object and for chaining you expect that chained calls will be visible on the original object.