Correct me if I'm wrong (I don't currently have a system to test this
with), but you can already do this caching yourself (if you need it)
by:

>>> c = Camp.objects.all()[1]
>>> myleaders = c.leaders.all()

Further iterations of myleaders should use the cached queryset.

Obviously, this doesn't help with performance of templates using {%
for leader in object.leaders.all %}, but I'm curious if there is as
much of need for multiple iterations of the same related field in a
template.

I know that the few places where I do multiple iterations of a related
field (or any sort of queryset, really) are in view code and those I
can (and do) optimize by creating a local cache variable per above.

So, I'm not sure if such an improvement is really necessary, again as
the biggest case I see _for_ it being template performance, and I'm
wondering if there might be a better way to optimize that single edge
instead (ie, is it worth it to have some caching added to
django.template's resolve_variable() for QuerySets?).

--
--Max Battcher--
http://www.worldmaker.net/

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to