Added prefetch optimize

This commit is contained in:
dormantman 2019-12-31 05:29:48 +03:00
parent d4e993abee
commit 241012da42

View File

@ -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: