Skip to content

Commit

Permalink
Add ical view
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-ni committed Oct 5, 2023
1 parent 249acf2 commit 6d4bcf8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
3 changes: 2 additions & 1 deletion hknweb/events/urls.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from django.urls import path
import hknweb.events.views as views

import hknweb.events.views as views

app_name = "events"

aggregate_display_urls = [
path("", views.index, name="index"),
path("ical/<uuid:id>.ics", views.ical, name="ical"),
path("leaderboard", views.get_leaderboard, name="leaderboard"),
path("photos", views.photos, name="photos"),
]
Expand Down
1 change: 1 addition & 0 deletions hknweb/events/views/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from hknweb.events.views.aggregate_displays import (
index,
ical,
get_leaderboard,
photos,
)
Expand Down
2 changes: 1 addition & 1 deletion hknweb/events/views/aggregate_displays/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from hknweb.events.views.aggregate_displays.calendar import index
from hknweb.events.views.aggregate_displays.calendar import ical, index
from hknweb.events.views.aggregate_displays.leaderboard import get_leaderboard
from hknweb.events.views.aggregate_displays.photos import photos
16 changes: 12 additions & 4 deletions hknweb/events/views/aggregate_displays/calendar.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import uuid
from typing import List

from django.shortcuts import render
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render

from hknweb.models import Profile
from hknweb.events.models import Event, EventType, GCalAccessLevelMapping
from hknweb.events.google_calendar_utils import 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
from hknweb.models import Profile
from hknweb.utils import allow_public_access, get_access_level
from hknweb.events.google_calendar_utils import get_calendar_link


@allow_public_access
Expand All @@ -29,6 +31,12 @@ def index(request):
)


@allow_public_access
def ical(request, *, id: uuid.UUID):
ical_view = get_object_or_404(ICalView, pk=id)
return HttpResponse(ical_view.to_ical_obj().to_ical())


def calendar_helper(
request,
title,
Expand Down

0 comments on commit 6d4bcf8

Please sign in to comment.