From 22fab55f2a708cbff926cccd4befefe6a49b37ea Mon Sep 17 00:00:00 2001 From: = Date: Mon, 5 Feb 2024 21:46:55 -0500 Subject: [PATCH] attempt to do issue 246 --- core/api/urls.py | 7 +++---- core/api/views/announcement.py | 4 ++-- core/api/views/events.py | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/core/api/urls.py b/core/api/urls.py index b876fa93..80fa6fb3 100644 --- a/core/api/urls.py +++ b/core/api/urls.py @@ -14,8 +14,8 @@ path("auth/token", TokenObtainPairView.as_view(), name="api_token_obtain_pair"), path("auth/token/refresh", TokenRefreshView.as_view(), name="api_token_refresh"), path("notifications/new", NotificationsNew.as_view(), name="api_notification_new"), - path("announcements", announcement, name="api_all_announcements"), - path("announcements/feed", announcementFeed, name="api_announcement_feed"), + path("announcements", AnnouncementListAll.as_view(), name="api_all_announcements"), + path("announcements/feed", AnnouncementListMyFeed.as_view(), name="api_announcement_feed"), path("organizations", ApiOrganizationList.as_view(), name="api_organization_list"), path( "organization/", @@ -28,8 +28,7 @@ path("me/schedule", UserMeSchedule.as_view(), name="api_me_schedule"), path("me/schedule/week", UserMeScheduleWeek.as_view(), name="api_me_schedule_week"), path("me/timetable", UserMeTimetable.as_view(), name="api_me_timetable"), - path("events", event, name="api_event_list"), - #path("events", EventsList.as_view(), name="api_event_list"), + path("events", EventsList.as_view(), name="api_event_list"), path("timetables", TimetableList.as_view(), name="api_timetable_list"), path( "timetable//schedule", diff --git a/core/api/views/announcement.py b/core/api/views/announcement.py index 3f1c5a52..d155ce6b 100644 --- a/core/api/views/announcement.py +++ b/core/api/views/announcement.py @@ -27,7 +27,7 @@ ], ) @api_view(["GET"]) -def announcement(request, year=None): +def AnnouncementListAll(ListAPIViewWithFallback): permission_classes = [permissions.AllowAny] serializer_class = serializers.AnnouncementSerializer @@ -52,7 +52,7 @@ def get_queryset(self): ], ) @api_view(["GET"]) -def announcementFeed(request, year=None): +def AnnouncementListMyFeed(ListAPIViewWithFallback): permission_classes = [permissions.IsAuthenticated | TokenHasScope] required_scopes = ["me_ann"] serializer_class = serializers.AnnouncementSerializer diff --git a/core/api/views/events.py b/core/api/views/events.py index 925004b3..14a92299 100644 --- a/core/api/views/events.py +++ b/core/api/views/events.py @@ -15,7 +15,7 @@ responses={200: EventSerializer(many=True)}, ) @api_view(["GET"]) -def event(request, year=None): +def EventsList(ListAPIViewWithFallback): permission_classes = [permissions.AllowAny] parser_classes = [JSONParser] serializer_class = serializers.EventSerializer