InfoTech-Backend/infotech/schedules/views.py

42 lines
1.4 KiB
Python
Raw Normal View History

from django.shortcuts import render
# Create your views here.
from rest_framework.permissions import IsAuthenticated
from rest_framework import viewsets, generics
2023-04-22 13:42:09 +08:00
from .serializers import ScheduleSerializer
2023-04-22 11:59:16 +08:00
from .models import Schedule, StudentSchedule
class ScheduleViewSet(viewsets.ModelViewSet):
# permission_classes = [IsAuthenticated]
serializer_class = ScheduleSerializer
queryset = Schedule.objects.all()
class FirstYearScheduleViewSet(generics.ListAPIView):
# permission_classes = [IsAuthenticated]
serializer_class = ScheduleSerializer
queryset = Schedule.objects.filter(year_level='1st Year')
2023-04-22 15:43:09 +08:00
lookup_field = 'semester'
class SecondYearScheduleViewSet(generics.ListAPIView):
# permission_classes = [IsAuthenticated]
serializer_class = ScheduleSerializer
queryset = Schedule.objects.filter(year_level='2nd Year')
2023-04-22 15:43:09 +08:00
lookup_field = 'semester'
class ThirdYearScheduleViewSet(generics.ListAPIView):
# permission_classes = [IsAuthenticated]
serializer_class = ScheduleSerializer
queryset = Schedule.objects.filter(year_level='3rd Year')
2023-04-22 15:43:09 +08:00
lookup_field = 'semester'
class FourthYearScheduleViewSet(generics.ListAPIView):
# permission_classes = [IsAuthenticated]
serializer_class = ScheduleSerializer
queryset = Schedule.objects.filter(year_level='4th Year')
2023-04-22 15:43:09 +08:00
lookup_field = 'semester'