...
 
Commits (2)
......@@ -535,7 +535,10 @@ class News(TemplateView):
template_name = 'news.html'
def get_context_data(self, **kwargs):
context = super(News, self).get_context_data(**kwargs)
context['focus'] = NewsItem.objects.exclude(date__gt=date.today()).filter(got_focus__isnull=False).select_related('category').order_by('-date')[:10]
context['focus'] = NewsItem.objects.exclude(date__gt=date.today() # publication date
).exclude(expiration_date__lt=date.today() # expiration date
).filter(got_focus__isnull=False
).select_related('category').order_by('-date')[:10]
context['news'] = NewsItem.objects.exclude(date__gt=date.today()).order_by('-date')
return context
......@@ -650,7 +653,7 @@ def onair(request):
d.update(get_current_nonstop_track())
if d.get('current_slot'):
del d['current_slot']
return JsonResponse(d)
return JsonResponse({'data': d})
class NewsItemDetailView(DetailView):
......