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')