class FacultyView(APIView):
def get(self, request):
faculties = Faculty.objects.all()
serializer = FacultySerializer(
instance=faculties,
many=True
)
return Response(serializer.data)
class FacultyViewSet(
mixins.ListModelMixin,
mixins.RetrieveModelMixin,
GenericViewSet
):
queryset = Faculty.objects.all()
serializer_class = FacultySerializer
permission_classes = (permissions.AllowAny, )