From 7f46ec067b068e340ef32d4d1d752fbaf09b4af9 Mon Sep 17 00:00:00 2001
From: George Katsikas <giorgakis.katsikas@gmail.com>
Date: Mon, 9 Sep 2024 12:50:03 +0200
Subject: [PATCH] try to optimize latest pub rss feed

---
 scipost_django/scipost/feeds.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/scipost_django/scipost/feeds.py b/scipost_django/scipost/feeds.py
index 07ae3fc6a..f5dc9a0f8 100644
--- a/scipost_django/scipost/feeds.py
+++ b/scipost_django/scipost/feeds.py
@@ -157,7 +157,13 @@ class LatestPublicationsFeedRSS(Feed):
     link = "/journals/"
 
     def get_object(self, request, specialty=None):
-        qs = Publication.objects.published()
+        qs = Publication.objects.published().prefetch_related(
+            "specialties",
+            "in_issue",
+            "in_issue__in_volume",
+            "in_issue__in_volume__in_journal",
+            "in_journal",
+        )
         if specialty:
             qs = qs.filter(specialties=specialty)
         self.specialty = specialty
-- 
GitLab