Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.

Only display talks for the current conference #1317

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion conference/talks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
14 changes: 14 additions & 0 deletions tests/test_talks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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