fix :exam/view.py del examrecord
This commit is contained in:
parent
5b785dfd79
commit
cc2525b266
|
@ -500,12 +500,16 @@ export default {
|
||||||
type: "error",
|
type: "error",
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await deleteUserExam(scope.row.id);
|
deleteUserExam(scope.row.id).then((res) => {
|
||||||
this.userList.splice(scope.row.index, 1);
|
console.log(res);
|
||||||
|
if (res.code >= 200) {
|
||||||
|
// this.userList.splice(scope.row.index, 1);
|
||||||
this.$message.success("成功");
|
this.$message.success("成功");
|
||||||
|
this.getList();
|
||||||
|
};
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async confirm(form) {
|
async confirm(form) {
|
||||||
|
|
|
@ -490,7 +490,7 @@ class ExamViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
||||||
instance = self.get_object()
|
instance = self.get_object()
|
||||||
if ExamRecord.objects.filter(exam=instance).exists():
|
if ExamRecord.objects.filter(exam=instance).exists():
|
||||||
raise ParseError('存在考试记录,禁止删除')
|
raise ParseError('存在考试记录,禁止删除')
|
||||||
instance.delete(soft=False)
|
instance.delete()
|
||||||
return Response(status=204)
|
return Response(status=204)
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, perms_map={'post': '*'}, serializer_class=Serializer, permission_classes = [IsAuthenticated])
|
@action(methods=['post'], detail=True, perms_map={'post': '*'}, serializer_class=Serializer, permission_classes = [IsAuthenticated])
|
||||||
|
@ -580,7 +580,7 @@ class ExamRecordViewSet(ListModelMixin, DestroyModelMixin, RetrieveModelMixin, G
|
||||||
return super().get_serializer_class()
|
return super().get_serializer_class()
|
||||||
|
|
||||||
def perform_destroy(self, instance): # 考试记录物理删除
|
def perform_destroy(self, instance): # 考试记录物理删除
|
||||||
instance.delete(soft=False)
|
instance.delete()
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=Serializer, permission_classes = [IsAuthenticated])
|
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=Serializer, permission_classes = [IsAuthenticated])
|
||||||
def clear(self, request, pk=None):
|
def clear(self, request, pk=None):
|
||||||
|
|
Loading…
Reference in New Issue