考试记录详情接口

This commit is contained in:
caoqianming 2022-11-14 15:46:57 +08:00
parent 10104b88f6
commit f16b7e7b45
1 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
from django.shortcuts import render
from rest_framework.viewsets import ModelViewSet, GenericViewSet
from rest_framework.mixins import ListModelMixin, DestroyModelMixin
from rest_framework.mixins import ListModelMixin, DestroyModelMixin, RetrieveModelMixin
from apps.exam.exports import export_question
from apps.exam.models import Question, Questioncat, PaperQuestion
from apps.exam.serializers import (QuestionSerializer, QuestioncatSerializer, PaperSerializer, ExamDetailSerializer, ExamRecordDetailSerializer, ExamListSerializer,
@ -306,7 +306,7 @@ class ExamViewSet(CreateUpdateCustomMixin, ModelViewSet):
if exam.paper:
er = ExamRecord()
er.type = '正式考试'
er.name = '正式考试' + now.strftime('%Y%m%d%H%M')
er.name = '正式考试' + datetime.now().strftime('%Y%m%d%H%M')
er.limit = exam.paper.limit
er.paper = exam.paper
er.total_score = exam.paper.total_score
@ -328,7 +328,7 @@ class ExamViewSet(CreateUpdateCustomMixin, ModelViewSet):
raise ParseError('暂不支持')
class ExamRecordViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet):
class ExamRecordViewSet(ListModelMixin, DestroyModelMixin, RetrieveModelMixin, GenericViewSet):
"""
考试记录列表和详情
"""