From e28436880c17bd13a2c89a69eb6cad25bcdc10a4 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 3 Jun 2019 20:09:57 +0800 Subject: [PATCH 1/4] just a test. nothing else --- lab/urls/student.py | 4 +++- lab/views/student.py | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lab/urls/student.py b/lab/urls/student.py index 9cc1e71..484664e 100644 --- a/lab/urls/student.py +++ b/lab/urls/student.py @@ -1,7 +1,9 @@ from django.conf.urls import url from ..views.student import LabAPI, LabDetailAPI +from ..views.student import ProblemHandInAPI urlpatterns = [ url(r"^lab_course_list/?$", LabAPI.as_view(), name="lab_list_api"), - url(r"^lab_course_detail/?$", LabDetailAPI.as_view(), name="lab_detail_api") + url(r"^lab_course_detail/?$", LabDetailAPI.as_view(), name="lab_detail_api"), + url(r"^problem_hand_in/?$", ProblemHandInAPI.as_view(), name="problem_hand_in_api") ] \ No newline at end of file diff --git a/lab/views/student.py b/lab/views/student.py index ec501ac..6545bc0 100644 --- a/lab/views/student.py +++ b/lab/views/student.py @@ -1,5 +1,6 @@ from utils.api import APIView from ..models import Lab +from ..models import LabProblem from course.models import Course from ..serializers import GetLabListSerializer,GetLabDetailSerializer @@ -31,3 +32,11 @@ def get(self, request): # return self.error(msg="不存在该实验", err=400) else: return self.error(msg="参数错误", err=400) + + +class ProblemHandInAPI(APIView): + def get(self, request): + # problem_list = request.GET.get('problem_list') + # problem_data = LabProblem.objects.all() + # return self.success(GetLabDetailSerializer(problem_data).data) + return self.success("我成功了!") From 124e40cc5a2296465c5adffea8de65fcc306795a Mon Sep 17 00:00:00 2001 From: wukeke <752869309@qq.com> Date: Mon, 3 Jun 2019 22:01:31 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E7=AB=AF=E8=80=83?= =?UTF-8?q?=E8=AF=95=E7=95=8C=E9=9D=A2=E9=A2=98=E7=9B=AE=E5=88=97=E8=A1=A8?= =?UTF-8?q?API=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lab/urls/student.py | 4 +--- user/urls/admin.py | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lab/urls/student.py b/lab/urls/student.py index 0574442..f0e4673 100644 --- a/lab/urls/student.py +++ b/lab/urls/student.py @@ -1,10 +1,8 @@ from django.conf.urls import url -<<<<<<< HEAD from ..views.student import LabAPI, LabDetailAPI from ..views.student import ProblemHandInAPI -======= + from ..views.student import LabAPI, LabDetailAPI, PostAttachmentAPI ->>>>>>> f41b34c98e220c015e90f23b3462ba25de110bd4 urlpatterns = [ url(r"^lab_course_list/?$", LabAPI.as_view(), name="lab_list_api"), diff --git a/user/urls/admin.py b/user/urls/admin.py index cb7be11..28265f8 100644 --- a/user/urls/admin.py +++ b/user/urls/admin.py @@ -16,7 +16,7 @@ url(r'student_get/?$', GetStudentAPI.as_view(), name="student_get"), url(r'student_update/?$', UpdateStudentAPI.as_view(), name="student_update"), - url(r'teacher_create/?$', CreateTeacherAPI.as_view(), name="teacher_create"), - url(r'teacher_get/?$', GetTeacherAPI.as_view(), name="teacher_get"), - url(r'teacher_update/?$', UpdateTeacherAPI.as_view(), name="teacher_update"), + # url(r'teacher_create/?$', CreateTeacherAPI.as_view(), name="teacher_create"), + # url(r'teacher_get/?$', GetTeacherAPI.as_view(), name="teacher_get"), + # url(r'teacher_update/?$', UpdateTeacherAPI.as_view(), name="teacher_update"), ] From bf17e9c4b1ad921d1c333c8ace5961946e762bbe Mon Sep 17 00:00:00 2001 From: wukeke <752869309@qq.com> Date: Mon, 3 Jun 2019 22:45:58 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E7=AB=AF=E8=80=83?= =?UTF-8?q?=E8=AF=95=E7=95=8C=E9=9D=A2=E9=A2=98=E7=9B=AE=E5=88=97=E8=A1=A8?= =?UTF-8?q?API=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lab/urls/student.py | 4 +++- lab/views/student.py | 15 +++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lab/urls/student.py b/lab/urls/student.py index f0e4673..8b7c212 100644 --- a/lab/urls/student.py +++ b/lab/urls/student.py @@ -1,6 +1,7 @@ from django.conf.urls import url from ..views.student import LabAPI, LabDetailAPI from ..views.student import ProblemHandInAPI +from ..view.student import TestDetailAPI from ..views.student import LabAPI, LabDetailAPI, PostAttachmentAPI @@ -8,5 +9,6 @@ url(r"^lab_course_list/?$", LabAPI.as_view(), name="lab_list_api"), url(r"^lab_course_detail/?$", LabDetailAPI.as_view(), name="lab_detail_api"), url(r"^problem_hand_in/?$", ProblemHandInAPI.as_view(), name="problem_hand_in_api"), - url(r"^lab_attachment_hand_in/?$", PostAttachmentAPI.as_view(), name='post-attachment') + url(r"^lab_attachment_hand_in/?$", PostAttachmentAPI.as_view(), name='post-attachment'), + url(r"^test_detail/?$", TestDetailAPI.as_view(), name='test-detail') ] \ No newline at end of file diff --git a/lab/views/student.py b/lab/views/student.py index e55b445..9c37895 100644 --- a/lab/views/student.py +++ b/lab/views/student.py @@ -39,10 +39,17 @@ def get(self, request): class ProblemHandInAPI(APIView): def get(self, request): - # problem_list = request.GET.get('problem_list') - # problem_data = LabProblem.objects.all() - # return self.success(GetLabDetailSerializer(problem_data).data) - return self.success("我成功了!") + problem_list = request.GET.get('problem_list') + problem_data = LabProblem.objects.filter(problem = problem_list) + return self.success(GetLabDetailSerializer(problem_data).data) + + +class TestDetailAPI(APIView): + def get(self,request): + id = request.GET.get('test_id') + problem_data = LabProblem.objects.filter(problem = problem_list).problem + return self.success(GetLabDetailSerializer(problem_data).data) + class PostAttachmentAPI(APIView): """ From 42b257090983405c18f211e35f58f0d95d995c84 Mon Sep 17 00:00:00 2001 From: wukeke <752869309@qq.com> Date: Mon, 3 Jun 2019 22:47:50 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E7=AB=AF=E8=80=83?= =?UTF-8?q?=E8=AF=95=E7=95=8C=E9=9D=A2=E9=A2=98=E7=9B=AE=E5=88=97=E8=A1=A8?= =?UTF-8?q?API=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lab/urls/student.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lab/urls/student.py b/lab/urls/student.py index 8b7c212..55a75d8 100644 --- a/lab/urls/student.py +++ b/lab/urls/student.py @@ -1,7 +1,7 @@ from django.conf.urls import url from ..views.student import LabAPI, LabDetailAPI from ..views.student import ProblemHandInAPI -from ..view.student import TestDetailAPI +from ..views.student import TestDetailAPI from ..views.student import LabAPI, LabDetailAPI, PostAttachmentAPI