Add moderation through calendar widget

This commit is contained in:
2025-02-20 17:47:51 +01:00
parent e936f0d285
commit a1bf86dabf
4 changed files with 166 additions and 28 deletions

View File

@ -2,10 +2,11 @@ from pathlib import Path
from typing import Literal
from django.conf import settings
from django.http import Http404
from django.http import Http404, HttpResponse
from ninja import Query
from ninja_extra import ControllerBase, api_controller, paginate, route
from ninja_extra.pagination import PageNumberPaginationExtra
from ninja_extra.permissions import IsAuthenticated
from ninja_extra.schemas import PaginatedResponseSchema
from com.calendar import IcsCalendar
@ -38,6 +39,17 @@ class CalendarController(ControllerBase):
def calendar_internal(self):
return send_raw_file(IcsCalendar.get_internal())
@route.get(
"/unmoderated.ics",
permissions=[IsAuthenticated],
url_name="calendar_unmoderated",
)
def calendar_unmoderated(self):
return HttpResponse(
IcsCalendar.get_unmoderated(self.context.request.user),
content_type="text/calendar",
)
@api_controller("/news")
class NewsController(ControllerBase):