diff --git a/lab/urls/student.py b/lab/urls/student.py index b2d3527..55a75d8 100644 --- a/lab/urls/student.py +++ b/lab/urls/student.py @@ -1,8 +1,14 @@ from django.conf.urls import url +from ..views.student import LabAPI, LabDetailAPI +from ..views.student import ProblemHandInAPI +from ..views.student import TestDetailAPI + from ..views.student import LabAPI, LabDetailAPI, PostAttachmentAPI 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_attachment_hand_in/?$", PostAttachmentAPI.as_view(), name='post-attachment') + 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"^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 5b959fd..9c37895 100644 --- a/lab/views/student.py +++ b/lab/views/student.py @@ -3,6 +3,7 @@ from utils.api import APIView from ..models import Lab +from ..models import LabProblem from course.models import Course from ..serializers import GetLabListSerializer, GetLabDetailSerializer, AttachmentSerializer @@ -36,6 +37,20 @@ def get(self, request): return self.error(msg="参数错误", err=400) +class ProblemHandInAPI(APIView): + def get(self, request): + 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): """ 学生在网页上传文件点击提交后,新增一条Attachment记录 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"), ]