def showStudent(self, request): stuObj = models.StudentInfo.objects.all() stuObjList = list() for item in stuObj: stuObjList.append(JsonHelper.json_serialize(item)) return HttpResponse( json.dumps(stuObjList, ensure_ascii=False))
def date(self, request): dateObj = models.RollCallDate.objects.all() date_obj_list = list() for item in dateObj: date_obj_list.append(JsonHelper.json_serialize(item)) return HttpResponse(json.dumps(date_obj_list, ensure_ascii=False))
def month(self, request): month = request.POST.get("month") month = "-" + month + "-" homeworkObj = models.HomeworkByMonth.objects.filter(uploadDate__icontains=month) homeworkObjList = list() for item in homeworkObj: homeworkObjList.append(JsonHelper.json_serialize(item)) return HttpResponse( json.dumps(homeworkObjList, ensure_ascii=False))
def detail(self, request): homeworkId = request.POST.get("homeworkId") homeworkObj = models.HomeworkDetail.objects.filter( homeworkId=homeworkId) homeworkObjList = list() for item in homeworkObj: homeworkObjList.append(JsonHelper.json_serialize(item)) return HttpResponse(json.dumps(homeworkObjList, ensure_ascii=False))
def doneQuestion(self, request): questionid = request.POST.get("questionId") homeworkObj = models.StudentUploadInfo.objects.filter( questionId=questionid) homeworkObjList = list() for item in homeworkObj: stuObj = models.StudentInfo.objects.get(stuId=item.stuId) item.stuName = stuObj.stuName homeworkObjList.append(JsonHelper.json_serialize(item)) return HttpResponse(json.dumps(homeworkObjList, ensure_ascii=False))
def detail(self, request): homeworkId = request.POST.get("homeworkId") stuId = request.POST.get("stuId") homeworkObj1 = models.HomeworkDetail.objects.filter(homeworkId=homeworkId) homeworkObjList1 = list() for item in homeworkObj1: homeworkObj2 = models.StudentUploadInfo.objects.get(stuId=stuId, questionId=item.id) item.status = homeworkObj2.status item.mark= homeworkObj2.mark homeworkObjList1.append(JsonHelper.json_serialize(item)) return HttpResponse( json.dumps(homeworkObjList1, ensure_ascii=False))
def detail(self, request): date = request.POST.get('date') rollCallObj = models.RollCallStuDetail.objects.filter(date=date) rollCallObjList = list() for item in rollCallObj: item.stuName = models.StudentInfo.objects.get( stuId=item.stuId).stuName rollCallObjList.append(JsonHelper.json_serialize(item)) return HttpResponse(json.dumps(rollCallObjList, ensure_ascii=False))