November 2015
Beginner to intermediate
840 pages
26h 30m
English
Every time we use a model manager to get data, we are fetching data from the database. This was perhaps obvious in our views, where that was rather the point. However, it is also true in our templates, where we use model manager methods liberally.
The problem is not that we are fetching data—we have to fetch data by necessity. The problem is that in many cases we are fetching the same information multiple times. Instead of fetching the related blog posts of a startup once, we’re fetching them a half-dozen times.
A key complication is that the actual number of queries Django makes in some of these templates changes depending on whether or not we’re authenticated with privileges. In our startup detail template, ...
Read now
Unlock full access