This commit is contained in:
caoqianming 2020-02-17 23:22:55 +08:00
commit 38be1b2e5f
1 changed files with 9 additions and 1 deletions

View File

@ -4278,6 +4278,14 @@ def apiuser(req):
userdict = userlist[0]
userdict['companyname'] = companyname
return HttpResponse(json.dumps(userdict, cls=MyEncoder), content_type="application/json")
elif a == 'get_user_from_username':
username = req.GET.get('username')
if username:
objs = User.objects.filter(username=username)
if objs.exists():
userdata = objs.values('name','username','ubelongpart__partname','usecomp__partname')
return JsonResponse({"code": 1, "data": list(userdata)[0]})
return JsonResponse({"code":0})
elif a == 'detailself':
userid = req.session['userid']
companyid = getcompany(userid)
@ -6006,7 +6014,7 @@ def apiexamtest(req):
elif a == 'detailtm':
id = req.GET.get('id')
test = ExamTest.objects.get(id=id)
objs = ExamPaperDetail.objects.filter(exampaper=test.exampaper).values(
objs = ExamPaperDetail.objects.filter(exampaper=test.exampaper).order_by('question__type').values(
'id', 'question__id', 'score', 'question__title', 'question__type', 'question__answer', 'question__right', 'question__resolution')
duration = test.duration
data = {'duration': duration, 'tms': list(objs)}