Commit a6acb375 authored by fred's avatar fred
Browse files

raise 404 on episode of missing emission

parent 02686c7d
...@@ -6,6 +6,7 @@ import stat ...@@ -6,6 +6,7 @@ import stat
import time import time
from django.conf import settings from django.conf import settings
from django.http import Http404
from django.views.decorators.cache import cache_control from django.views.decorators.cache import cache_control
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
...@@ -111,7 +112,10 @@ class EpisodeDetailView(DetailView, EmissionMixin): ...@@ -111,7 +112,10 @@ class EpisodeDetailView(DetailView, EmissionMixin):
context['sectionName'] = "Emissions" context['sectionName'] = "Emissions"
context['diffusions'] = Diffusion.objects.select_related().filter( context['diffusions'] = Diffusion.objects.select_related().filter(
episode=self.object.id).order_by('datetime') episode=self.object.id).order_by('datetime')
context['emission'] = Emission.objects.get(slug=self.kwargs.get('emission_slug')) try:
context['emission'] = Emission.objects.get(slug=self.kwargs.get('emission_slug'))
except Emission.DoesNotExist:
raise Http404()
context.update(self.get_emission_context(context['emission'])) context.update(self.get_emission_context(context['emission']))
return context return context
episode = EpisodeDetailView.as_view() episode = EpisodeDetailView.as_view()
......
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