November 2015
Beginner to intermediate
840 pages
26h 30m
English
Caching properties in our model is a great start to optimizing the Startup detail views, but it only works for unauthenticated users. If you authenticate as a superuser and browse to /startup/simple-robots/, the debug-toolbar will tell you that Django is making 14 queries to display all of the data on this page. That is the same number we had at the beginning of last section and means that the page has not benefitted from our @cached_property decorator, which makes sense: the published_posts() is only called when the visitor doesn’t have the view_future_post permission. As an authenticated superuser, we have this permission, so our page is instead calling startup.blog_posts.all() to render the page.
The problem ...
Read now
Unlock full access