I think ORM should have some kind of caching. For example, in docs[1], when we do:
>>> e = Entry.objects.get(pk=1) >>> e.blog # Hits database >>> e.blog # Don't hit database But let's imagine we have a third model named Author: class Author(models.Model): name = models.CharField(max_length=50) blog = models.OneToOneField(Blog) When we do: >>> a = Author.objects.get(pk=1) >>> b = a.blog # Hit's database >>> b.author # Hits database again What do you think in saving the author value in the blog instance if it is achieved through the author instance? It's something like telling blog who is his author in the moment you are retrieving it from the author. The same concept can be used in ForeignKey also. Whe we do: >>> b = Blog.objects.get(pk=1) >>> for entry in b.entry_set.all(): ... entry.blog # hits database to retrieve the blog in each iteration. What do you think about it? -------- Vinícius Mendes Engenheiro de Computação Meio Código - A peça que faltava para o seu código! URL http://www.meiocodigo.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---