From 75971a4b64fa7ec7748302f084d175a0b4af734f Mon Sep 17 00:00:00 2001 From: Peter Siemens Date: Tue, 24 Oct 2023 23:22:50 -0700 Subject: [PATCH] Add comment to ArticlePageManager.get_queryset --- article/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/article/models.py b/article/models.py index 276045a21..0bd99cad2 100644 --- a/article/models.py +++ b/article/models.py @@ -418,6 +418,12 @@ class Meta: class ArticlePageManager(PageManager): def get_queryset(self): + """ + Extend the default queryset to prefetch featured images for all articles. + + This significantly reduces the number of database queries on pages that list + a large number of articles. + """ return super() \ .get_queryset() \ .prefetch_related('featured_media__image')