Commit ab804dd5 authored by fred's avatar fred

exclude obsolete newsitem off focus space

parent 15d4af14
......@@ -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
......
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