from drf_yasg import openapi from drf_yasg.utils import swagger_auto_schema, status from rest_framework import viewsets from content.models import Question from content.serializers import QuestionSerializer from lib.api.permissions import IsAuthorOrReadOnly class QuestionViewSet(viewsets.ModelViewSet): queryset = Question.objects.all() serializer_class = QuestionSerializer permission_classes = ( IsAuthorOrReadOnly, ) @swagger_auto_schema( request_body=openapi.Schema( type=openapi.TYPE_OBJECT, properties={ "question": openapi.Schema( type=openapi.TYPE_STRING, description="Email Address" ), "awnser": openapi.Schema( type=openapi.TYPE_STRING, description="Previous Password" ), "label": openapi.Schema( type=openapi.TYPE_STRING, description="New Password" ), }, ), responses={ status.HTTP_202_ACCEPTED: openapi.Schema( type=openapi.TYPE_OBJECT, properties={ "status": openapi.Schema(type=openapi.TYPE_NUMBER), "message": openapi.Schema(type=openapi.TYPE_STRING), }, ), status.HTTP_401_UNAUTHORIZED: openapi.Schema( type=openapi.TYPE_OBJECT, properties={ "status": openapi.Schema(type=openapi.TYPE_NUMBER), "message": openapi.Schema(type=openapi.TYPE_STRING), }, ), }, ) def create(self, request): pass