From 241012da424217f4dff895e352e8312ea1a0a58f Mon Sep 17 00:00:00 2001 From: dormantman Date: Tue, 31 Dec 2019 05:29:48 +0300 Subject: [PATCH] Added prefetch optimize --- apps/news/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/news/tasks.py b/apps/news/tasks.py index c08ee8c7..4a980144 100644 --- a/apps/news/tasks.py +++ b/apps/news/tasks.py @@ -20,7 +20,7 @@ def send_email_with_news(news_ids): htmly = get_template(settings.NEWS_EMAIL_TEMPLATE) year = datetime.now().year - socials = list(SiteSettings.objects.with_country()) + socials = list(SiteSettings.objects.with_country().select_related('country')) socials = dict(zip(map(lambda social: social.country.code, socials), socials)) for subscriber in subscribers: