Hi again, > > john = Author.objects.get(name='john') > books = list(john.book_set.all()) > > # Does a database query, but should be smart enough to simply return john. > books[0].author > """ > > I'm pretty sure there's a long-standing ticket for this, but I'm not > sure which one it is. Shai, does your solution approach this in a way > that can solve the issue for ForeignKeys as well? > Only the tests...
My solution is a little modification on the descriptors used for the related objects. But for foreign keys, the relevant descriptor returns a manager which uses the QuerySet of the related model's default manager. To get the desired behavior, that manager should modify (or wrap) this QuerySet, to seed the cache on each object it returns. I may have time to work on something like this, but probably only next week. Shai. -- 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.