From 22dc106f103939bd9e529f8d0cc31cf0548250af Mon Sep 17 00:00:00 2001 From: Oliver Ni Date: Wed, 4 Oct 2023 23:30:05 -0700 Subject: [PATCH] Fix link again (whoops) --- hknweb/events/views/aggregate_displays/calendar.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hknweb/events/views/aggregate_displays/calendar.py b/hknweb/events/views/aggregate_displays/calendar.py index 6e8b016c..f10bde6a 100644 --- a/hknweb/events/views/aggregate_displays/calendar.py +++ b/hknweb/events/views/aggregate_displays/calendar.py @@ -4,7 +4,7 @@ from django.http import HttpResponse from django.shortcuts import get_object_or_404, render -from hknweb.events.google_calendar_utils import get_calendar_link +from hknweb.events.google_calendar_utils import SHARE_LINK_TEMPLATE, get_calendar_link from hknweb.events.models import Event, EventType, GCalAccessLevelMapping, ICalView from hknweb.events.models.constants import ACCESS_LEVELS from hknweb.events.utils import get_events @@ -92,12 +92,14 @@ def get_calendars(request, user_access_level: int): ) ical_view, _ = ICalView.objects.get_or_create(user=request.user) + ical_url = request.build_absolute_uri(ical_view.url).replace( + "https://", "webcal://" + ) + print(ical_url) calendars.append( { "name": "personal (ics)", - "link": get_calendar_link( - calendar_id=ical_view.url.replace("https://", "webcal://") - ), + "link": SHARE_LINK_TEMPLATE.format(cid=ical_url), } )