mirror of
https://github.com/lemeow125/DocManagerBackend.git
synced 2025-01-19 01:23:02 +08:00
28 lines
863 B
Python
28 lines
863 B
Python
from rest_framework import generics
|
|
from .serializers import QuestionnaireSerializer
|
|
from rest_framework.permissions import IsAuthenticated
|
|
from .models import Questionnaire
|
|
from rest_framework.pagination import PageNumberPagination
|
|
from accounts.permissions import IsStaff, IsPlanning
|
|
|
|
|
|
class QuestionnaireListAPIView(generics.ListAPIView):
|
|
"""
|
|
Used by staff to view questionnaires
|
|
"""
|
|
|
|
http_method_names = ["get"]
|
|
serializer_class = QuestionnaireSerializer
|
|
queryset = Questionnaire.objects.all()
|
|
pagination_class = PageNumberPagination
|
|
permission_classes = [IsAuthenticated, IsPlanning]
|
|
|
|
|
|
class QuestionnaireSubmitView(generics.CreateAPIView):
|
|
"""
|
|
Used by clients to submit questionnaires
|
|
"""
|
|
|
|
http_method_names = ["post"]
|
|
serializer_class = QuestionnaireSerializer
|
|
permission_classes = [IsAuthenticated]
|