authentication
This commit is contained in:
parent
ac1919161a
commit
1a2cc00aab
|
@ -129,7 +129,7 @@ class ConsumerViewSet(ModelViewSet):
|
|||
PaySubject.objects.get_or_create(consumer = instance, subject__id=i, defaults={'consumer':instance,'subject':Questioncat.objects.get(id=i)})
|
||||
return Response(serializer.data)
|
||||
|
||||
@action(methods=['get'], detail=False, permission_classes=[IsAuthenticated], authentication_classes=[ConsumerTokenAuthentication],
|
||||
@action(methods=['get'], detail=False, permission_classes=[], authentication_classes=[ConsumerTokenAuthentication],
|
||||
url_path='subjectpaid', url_name='subject_paid')
|
||||
def has_paid(self, request):
|
||||
"""
|
||||
|
@ -156,7 +156,7 @@ class ConsumerViewSet(ModelViewSet):
|
|||
else:
|
||||
return Response({'error':result['data']})
|
||||
|
||||
@action(methods=['post','delete','get'], detail=False, permission_classes=[IsAuthenticated], authentication_classes=[ConsumerTokenAuthentication],
|
||||
@action(methods=['post','delete','get'], detail=False, permission_classes=[], authentication_classes=[ConsumerTokenAuthentication],
|
||||
url_path='collects', url_name='create_collects')
|
||||
def collects(self, request):
|
||||
'''
|
||||
|
@ -274,7 +274,7 @@ class ConsumerRegister(APIView):
|
|||
验证码登陆和注册
|
||||
'''
|
||||
authentication_classes = [ConsumerTokenAuthentication]
|
||||
permission_classes = [IsAuthenticated]
|
||||
permission_classes = []
|
||||
def post(self, request, *args, **kwargs):
|
||||
data = request.data
|
||||
phone = data.get('phone', None)
|
||||
|
|
|
@ -26,7 +26,7 @@ from utils.custom import CommonPagination
|
|||
|
||||
class MoniTestView(APIView):
|
||||
authentication_classes = [ConsumerTokenAuthentication]
|
||||
permission_classes = [IsAuthenticated]
|
||||
permission_classes = []
|
||||
def post(self, request, *args, **kwargs):
|
||||
serializer = MoniTestSerializer(data = request.data)
|
||||
if serializer.is_valid():
|
||||
|
@ -57,7 +57,7 @@ class MoniTestView(APIView):
|
|||
|
||||
class MyExamTestView(APIView):
|
||||
authentication_classes = [ConsumerTokenAuthentication]
|
||||
permission_classes = [IsAuthenticated]
|
||||
permission_classes = []
|
||||
def get(self, request, *args, **kwargs):
|
||||
queryset = ExamTest.objects.filter(consumer=request.user)
|
||||
pg = CommonPagination()
|
||||
|
@ -67,7 +67,7 @@ class MyExamTestView(APIView):
|
|||
|
||||
class MyExamTestFxView(APIView):
|
||||
authentication_classes = [ConsumerTokenAuthentication]
|
||||
permission_classes = [IsAuthenticated]
|
||||
permission_classes = []
|
||||
def get(self, request, *args, **kwargs):
|
||||
queryset = ExamTest.objects.filter(consumer=request.user)
|
||||
ret = {}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -152,7 +152,7 @@ class QuestionViewSet(ModelViewSet):
|
|||
wb = load_workbook(fullpath)
|
||||
sheet = wb.worksheets[0]
|
||||
qlist = ['A','B','C','D','E','F']
|
||||
leveldict = {'低':1,'中':2,'高':3}
|
||||
leveldict = {'低':'低','中':'中','高':'高'}
|
||||
notinlist = []
|
||||
# 验证文件内容
|
||||
if sheet['a2'].value != '题目类型':
|
||||
|
@ -199,15 +199,13 @@ class QuestionViewSet(ModelViewSet):
|
|||
obj.type = '单选'
|
||||
obj.questioncat = cateobj
|
||||
obj.name = name
|
||||
obj.answer=answer
|
||||
obj.options=answer
|
||||
obj.right = right
|
||||
obj.resolution = resolution if resolution else ''
|
||||
if level in leveldict:
|
||||
obj.level = leveldict[level]
|
||||
else:
|
||||
obj.level = 1
|
||||
obj.usecomps = ','+companyid+','
|
||||
obj.createuser = user
|
||||
obj.level = '低'
|
||||
obj.save()
|
||||
elif type == '多选':
|
||||
right = list(right)
|
||||
|
@ -221,13 +219,13 @@ class QuestionViewSet(ModelViewSet):
|
|||
obj.type = '多选'
|
||||
obj.questioncat = cateobj
|
||||
obj.name = name
|
||||
obj.answer=answer
|
||||
obj.options=answer
|
||||
obj.right = right
|
||||
obj.resolution = resolution if resolution else ''
|
||||
if level in leveldict:
|
||||
obj.level = leveldict[level]
|
||||
else:
|
||||
obj.level = 1
|
||||
obj.level = '低'
|
||||
obj.save()
|
||||
elif type == '判断':
|
||||
if right == 'A' or right == '对' or right == '正确':
|
||||
|
@ -241,13 +239,13 @@ class QuestionViewSet(ModelViewSet):
|
|||
obj.type = '判断'
|
||||
obj.questioncat = cateobj
|
||||
obj.name = name
|
||||
obj.answer={'A':'对','B':'错'}
|
||||
obj.options={'A':'对','B':'错'}
|
||||
obj.right = right
|
||||
obj.resolution = resolution if resolution else ''
|
||||
if level in leveldict:
|
||||
obj.level = leveldict[level]
|
||||
else:
|
||||
obj.level = 1
|
||||
obj.level = '低'
|
||||
obj.save()
|
||||
i = i +1
|
||||
if notinlist:
|
||||
|
@ -257,7 +255,7 @@ class QuestionViewSet(ModelViewSet):
|
|||
|
||||
class ExerciseView(APIView):
|
||||
authentication_classes = [ConsumerTokenAuthentication]
|
||||
permission_classes = [IsAuthenticated]
|
||||
permission_classes = []
|
||||
def post(self, request):
|
||||
questioncat = request.data['questioncat']
|
||||
queryset = Question.objects.filter(is_delete=0,questioncat=questioncat)
|
||||
|
|
Loading…
Reference in New Issue