Skip to content

Commit

Permalink
Prefetch featured media for all articles
Browse files Browse the repository at this point in the history
  • Loading branch information
psiemens committed Oct 19, 2023
1 parent 109ba39 commit 7e5b3d8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion article/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,12 @@ class Meta:

#-----Manager models-----
class ArticlePageManager(PageManager):


def get_queryset(self):
return super() \
.get_queryset() \
.prefetch_related('featured_media__image')

def from_section(self, section_slug='', section_root=None) -> QuerySet:
from .models import ArticlePage
from section.models import SectionPage
Expand Down

0 comments on commit 7e5b3d8

Please sign in to comment.