Skip to content
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
10 changes: 7 additions & 3 deletions backend/api/cms/page/queries/cms_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ def cms_page(
)
can_see_page = None

if password_restriction and password_restriction.password == "ticket":
if (
password_restriction
and password_restriction.password
and password_restriction.password.startswith("ticket-")
):
from conferences.models import Conference

# hack so we can go live with this feature for now :)
conference = Conference.objects.get(code="pycon2026")
conference_code = password_restriction.password.split("-")[1]
conference = Conference.objects.get(code=conference_code)

user = info.context.request.user
can_see_page = user.is_authenticated and user_has_admission_ticket(
Expand Down
8 changes: 4 additions & 4 deletions backend/api/cms/tests/page/queries/test_cms_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_page(graphql_client, locale):
"title": "Bubble",
"slug": "bubble-tea",
"body": [
{"title": "I've Got a Lovely Bunch of " "Coconuts"},
{"title": "I've Got a Lovely Bunch of Coconuts"},
{
"latitude": "43.766199999999997771737980656325817108154296875", # noqa: E501
"longitude": "3.140000000000000124344978758017532527446746826171875", # noqa: E501
Expand Down Expand Up @@ -90,7 +90,7 @@ def test_page_with_ticket_restriction_and_ticket_returns_content(
)
page.save_revision().publish()
PageViewRestriction.objects.create(
page=page, restriction_type="password", password="ticket"
page=page, restriction_type="password", password="ticket-pycon2025"
)
SiteFactory(hostname="pycon", port=80, root_page=parent)
page.copy_for_translation(locale=locale("it"))
Expand Down Expand Up @@ -161,7 +161,7 @@ def test_page_with_ticket_restriction_without_ticket_returns_first_block(
)
page.save_revision().publish()
PageViewRestriction.objects.create(
page=page, restriction_type="password", password="ticket"
page=page, restriction_type="password", password="ticket-pycon2025"
)
SiteFactory(hostname="pycon", port=80, root_page=parent)
page.copy_for_translation(locale=locale("it"))
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_page_with_ticket_restriction_without_ticket_returns_first_block(
"title": "Bubble",
"slug": "bubble-tea",
"body": [
{"title": "I've Got a Lovely Bunch of " "Coconuts"},
{"title": "I've Got a Lovely Bunch of Coconuts"},
],
}
}
Expand Down
Loading