Commit 782de96a authored by fred's avatar fred
Browse files

performance: compute queries for home page in context

parent d5333e39
......@@ -169,9 +169,10 @@ class Home(TemplateView):
def get_context_data(self, **kwargs):
context = super(Home, self).get_context_data(**kwargs)
context['newsImaged'] = NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[:3]
context['news'] = NewsItem.objects.all().order_by('-datetime')[:60]
context['emissions'] = Emission.objects.filter(archived=False).order_by('title')
context['newsImaged'] = list(NewsItem.objects.all().exclude(
image__isnull=True).exclude(image__exact='').order_by('-datetime')[:3])
context['news'] = list(NewsItem.objects.all().order_by('-datetime')[:60])
context['emissions'] = list(Emission.objects.filter(archived=False).order_by('title'))
context['player'] = audioPlayer()
return context
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment