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

Commit 412bfc7

Browse files
jvikmanJuho Vikman
andauthored
Only display talks for the current conference (#1317)
Co-authored-by: Juho Vikman <[email protected]>
1 parent ce72b03 commit 412bfc7

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

conference/talks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ def talk(request, talk_slug):
1414
"""
1515
Display Talk
1616
"""
17-
talk = get_object_or_404(Talk, slug=talk_slug)
17+
current_conf = Conference.objects.current().code
18+
talk = get_object_or_404(Talk, slug=talk_slug, conference=current_conf)
1819
talk_as_dict = dump_relevant_talk_information_to_dict(talk)
1920

2021
can_update_talk = request.user.is_authenticated and can_user_update_talk(

tests/test_talks.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,3 +265,17 @@ def test_view_slides_url_on_talk_detail_page(client):
265265
response = client.get(url)
266266

267267
assert 'download/view slides' in response.content.decode().lower()
268+
269+
270+
def test_talk_for_other_than_current_conference(client):
271+
"""
272+
Only display talks for the current conference.
273+
"""
274+
get_default_conference()
275+
other_conference = get_default_conference(code='ep_other')
276+
talk_in_other_conference = TalkFactory(conference=other_conference.code)
277+
278+
url = reverse("talks:talk", args=[talk_in_other_conference.slug])
279+
resp = client.get(url)
280+
281+
assert resp.status_code == 404

0 commit comments

Comments
 (0)