Changes between Version 7 and Version 8 of DjangoSpecifications/Core/SingleInstance


Ignore:
Timestamp:
Mar 24, 2008, 6:09:44 AM (17 years ago)
Author:
David Cramer
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DjangoSpecifications/Core/SingleInstance

    v7 v8  
    5757        return u"%s (%s)" % (self.title, self.type_of_article.name)
    5858
    59 {% for article in Article.objects.all %}
    60 {{article}}
     59{% for article in Article.objects.filter(type=1) %}
     60{{ article.type }}
    6161{% endfor %}
    6262}}}
     63
     64In the above example, type is only queried for once, because each iteration it knows that it's already in memory via the instance caching. This is a '''very''' common use case for many developers.
    6365
    6466If you have a great number of articles and a smaller number of articletypes the performance/memory hit is staggering because:
Back to Top