Commit 4d705a72 authored by fred's avatar fred

don't publish newitems before their publication date

parent 2f7722ea
......@@ -497,7 +497,7 @@ class Home(TemplateView):
def get_context_data(self, **kwargs):
context = super(Home, self).get_context_data(**kwargs)
context['emissions'] = Emission.objects.filter(archived=False).order_by('-creation_timestamp')[:3]
context['newsitems'] = NewsItem.objects.order_by('-date')[:3]
context['newsitems'] = NewsItem.objects.exclude(date__gt=date.today()).order_by('-date')[:3]
context['soundfiles'] = SoundFile.objects.prefetch_related('episode__emission__categories').filter(
podcastable=True, fragment=False) \
......@@ -529,8 +529,8 @@ 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.filter(got_focus__isnull=False).select_related('category').order_by('-date')[:10]
context['news'] = NewsItem.objects.all().order_by('-date')
context['focus'] = NewsItem.objects.exclude(date__gt=date.today()).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
news = News.as_view()
......@@ -540,9 +540,9 @@ class Agenda(TemplateView):
template_name = 'agenda.html'
def get_context_data(self, **kwargs):
context = super(Agenda, self).get_context_data(**kwargs)
context['agenda'] = NewsItem.objects.filter(
context['agenda'] = NewsItem.objects.exclude(date__gt=date.today()).filter(
event_date__gte=date.today()).order_by('date')[:20]
context['news'] = NewsItem.objects.all().order_by('-date')
context['news'] = NewsItem.objects.exclude(date__gt=date.today()).order_by('-date')
context['previous_month'] = datetime.today().replace(day=1) - timedelta(days=2)
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