import change
This commit is contained in:
parent
6ecd93bfb1
commit
762b9616ff
|
@ -4,6 +4,8 @@ from django.contrib.postgres.fields import JSONField, ArrayField
|
|||
from question.models import Questioncat, Question
|
||||
from crm.models import Consumer
|
||||
|
||||
|
||||
|
||||
# Create your models here.
|
||||
class TestRule(SoftCommonModel):
|
||||
name = models.CharField(max_length=200, unique=True, verbose_name='名称')
|
||||
|
@ -28,6 +30,10 @@ class TestRule(SoftCommonModel):
|
|||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class WorkScope(SoftCommonModel):
|
||||
name = models.CharField(max_length=200, unique=True, verbose_name='名称')
|
||||
questioncat = models.ManyToManyField(Questioncat, verbose_name='所选题库')
|
||||
rule = models.ForeignKey(TestRule, on_delete=models.CASCADE, verbose_name='试卷结构')
|
||||
|
||||
class Paper(SoftCommonModel):
|
||||
name = models.CharField(max_length=200, verbose_name='名称')
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,22 @@
|
|||
# Generated by Django 3.0.4 on 2020-03-25 01:59
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('question', '0007_auto_20200319_0846'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='questioncat',
|
||||
options={'verbose_name': '题库/学科类别', 'verbose_name_plural': '题库/学科类别'},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='questioncat',
|
||||
name='type',
|
||||
field=models.CharField(choices=[('公共', '公共'), ('专业', '专业')], default='专业', max_length=50, verbose_name='科目类型'),
|
||||
),
|
||||
]
|
|
@ -5,11 +5,16 @@ from django.contrib.postgres.fields import JSONField, ArrayField
|
|||
|
||||
|
||||
class Questioncat(SoftCommonModel):
|
||||
type_choices = (
|
||||
('公共', '公共'),
|
||||
('专业', '专业'),
|
||||
)
|
||||
name = models.CharField(max_length=200, unique=True, verbose_name='名称')
|
||||
pid = models.ForeignKey('self', verbose_name='父', null=True, blank=True, on_delete=models.CASCADE, related_name='questioncatpid')
|
||||
is_subject = models.BooleanField(default=False, verbose_name='是否是学科')
|
||||
type = models.CharField(max_length=50, default='专业', choices=type_choices, verbose_name='科目类型')
|
||||
class Meta:
|
||||
verbose_name = '题库类别/学科类别'
|
||||
verbose_name = '题库/学科类别'
|
||||
verbose_name_plural = verbose_name
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
@ -9,6 +9,7 @@ from rest_framework import status
|
|||
from django_filters.rest_framework import DjangoFilterBackend
|
||||
from openpyxl import Workbook, load_workbook
|
||||
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
|
||||
import json
|
||||
|
||||
from utils.custom import CommonPagination
|
||||
from rbac.permission import RbacPermission
|
||||
|
@ -69,7 +70,7 @@ class QuestioncatViewSet(ModelViewSet):
|
|||
serializer_class = QuestioncatSerializer
|
||||
pagination_class = CommonPagination
|
||||
ordering_fields = ['id']
|
||||
ordering = ['id']
|
||||
ordering = ['type','id']
|
||||
filter_backends = [DjangoFilterBackend, SearchFilter, OrderingFilter]
|
||||
filterset_fields = ['pid']
|
||||
search_fields = ['^name']
|
||||
|
@ -185,7 +186,9 @@ class QuestionViewSet(ModelViewSet):
|
|||
answer['F'] = sheet['i'+str(i)].value
|
||||
right = sheet['j'+str(i)].value.replace(' ', '')
|
||||
resolution = sheet['k'+str(i)].value
|
||||
level = sheet['l'+str(i)].value.replace(' ', '')
|
||||
level = sheet['l'+str(i)].value
|
||||
if level:
|
||||
level = level.replace(' ', '')
|
||||
if questioncat not in questioncatdict:
|
||||
return Response({"error":"不存在分类("+questioncat+")!请先新建"})
|
||||
else:
|
||||
|
@ -248,10 +251,7 @@ class QuestionViewSet(ModelViewSet):
|
|||
obj.level = '低'
|
||||
obj.save()
|
||||
i = i +1
|
||||
if notinlist:
|
||||
return {"code":206,"data":notinlist,"msg":"导入部分成功"}
|
||||
else:
|
||||
return Response(status=status.HTTP_200_OK)
|
||||
return Response(status=status.HTTP_200_OK)
|
||||
|
||||
class ExerciseView(APIView):
|
||||
authentication_classes = [ConsumerTokenAuthentication]
|
||||
|
|
Loading…
Reference in New Issue