From a39112f7301363d7ad0c1e3f706571bd2953d881 Mon Sep 17 00:00:00 2001 From: Jimin Ha Date: Mon, 21 Feb 2022 12:44:25 +0900 Subject: [PATCH] Resolve conflict while cherry picking --- backend/qna/models.py | 1 + backend/qna/serializers.py | 6 ++---- backend/qna/tests.py | 2 +- backend/qna/views/professor.py | 26 +++++++++++++------------- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/backend/qna/models.py b/backend/qna/models.py index e3ce84c71..b0a0c4f22 100644 --- a/backend/qna/models.py +++ b/backend/qna/models.py @@ -18,6 +18,7 @@ class Question(models.Model): create_time = models.DateTimeField(auto_now_add=True) last_update_time = models.DateTimeField(auto_now=True) is_resolved = models.BooleanField(default=True) + class Meta: db_table = "question" ordering = ("-create_time",) diff --git a/backend/qna/serializers.py b/backend/qna/serializers.py index 6e8fe0358..acea269bb 100644 --- a/backend/qna/serializers.py +++ b/backend/qna/serializers.py @@ -20,10 +20,8 @@ class CreateQuestionSerializer(serializers.Serializer): class EditQuestionSerializer(serializers.Serializer): id = serializers.IntegerField() - - class Meta: - model = Question - fields = ("title", "content") + title = serializers.CharField(max_length=128) + content = serializers.CharField(max_length=1024 * 1024 * 8) class AnswerSerializer(serializers.Serializer): diff --git a/backend/qna/tests.py b/backend/qna/tests.py index a6d396a1e..f226dcc0f 100644 --- a/backend/qna/tests.py +++ b/backend/qna/tests.py @@ -1,4 +1,4 @@ -from copy import deepcopy +import copy from utils.api.tests import APITestCase from .models import Question, Answer from course.models import Course diff --git a/backend/qna/views/professor.py b/backend/qna/views/professor.py index 3097ba560..ecd09ecc9 100644 --- a/backend/qna/views/professor.py +++ b/backend/qna/views/professor.py @@ -11,19 +11,19 @@ class QuestionAPI(APIView): @swagger_auto_schema( manual_parameters=[ openapi.Parameter( - name="course_id", - in_=openapi.IN_QUERY, - description="Id of course", - required=True, - type=openapi.TYPE_INTEGER, - ), - openapi.Parameter( - name="question_id", in_=openapi.IN_QUERY, - type=openapi.TYPE_INTEGER, - required=False - ), - ], - operation_description="Get Question" + name="course_id", + in_=openapi.IN_QUERY, + description="Id of course", + required=True, + type=openapi.TYPE_INTEGER, + ), + openapi.Parameter( + name="question_id", in_=openapi.IN_QUERY, + type=openapi.TYPE_INTEGER, + required=False + ), + ], + operation_description="Get Question" ) @admin_role_required def get(self, request):