On Jan 29, 4:25 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> b = Blog.objects.get(id=1)
> for entry in b.entry_set.all():
> entry.blog is b # True
So what if the blog with id=1 changes in between accesses? What if I
had
b = Blog.objects.get(id=1)
[ I do some other things here, and meanwhile the title of blog with
id=1 was changed]
for entry in b.entry_set.all():
entry.blog is b # Is this still true?
entry.blog.title is b.title # How about this?
The caching should probably not always be automatic, but rather
explicit.
I could maybe agree that objects from the some should be cached, for
example:
entry1, entry2 = b.entry_set.all()[:2]
entry1.blog is entry2.blog
because it came from a single query. But then again, even with a
single query you might do things when looping through the returned
objects where you want the latest version of the object in each
iteration. You might also want to do things differently depending on
whether or not the code is in a transaction block or depending on the
isolation level. Someone with more database experience than I should
chime in here.
Gary
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---