diff --git a/conference/talks.py b/conference/talks.py index 1f46c838c..3aab2d5c3 100644 --- a/conference/talks.py +++ b/conference/talks.py @@ -14,7 +14,8 @@ def talk(request, talk_slug): """ Display Talk """ - talk = get_object_or_404(Talk, slug=talk_slug) + current_conf = Conference.objects.current().code + talk = get_object_or_404(Talk, slug=talk_slug, conference=current_conf) talk_as_dict = dump_relevant_talk_information_to_dict(talk) can_update_talk = request.user.is_authenticated and can_user_update_talk( diff --git a/tests/test_talks.py b/tests/test_talks.py index 2e7e320fd..1f9d8bf47 100644 --- a/tests/test_talks.py +++ b/tests/test_talks.py @@ -265,3 +265,17 @@ def test_view_slides_url_on_talk_detail_page(client): response = client.get(url) assert 'download/view slides' in response.content.decode().lower() + + +def test_talk_for_other_than_current_conference(client): + """ + Only display talks for the current conference. + """ + get_default_conference() + other_conference = get_default_conference(code='ep_other') + talk_in_other_conference = TalkFactory(conference=other_conference.code) + + url = reverse("talks:talk", args=[talk_in_other_conference.slug]) + resp = client.get(url) + + assert resp.status_code == 404