mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 11:59:23 +00:00
Add moderation through calendar widget
This commit is contained in:
14
com/api.py
14
com/api.py
@ -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):
|
||||
|
Reference in New Issue
Block a user