def handle_list_lesson(self, request): self.checkMandatoryParams(request, ['pagenum', 'pagesize']) pagenum = int(request.param_dict['pagenum']) pagesize = int(request.param_dict['pagesize']) teacherid = request.session['teacherid'] clist, cidlist = Teacher.get_teach_courses(teacherid) paramdict = request.param_dict.dict() paramdict['course_ids'] = cidlist return JsonResponse(Lesson.list(pagenum, pagesize, paramdict))
def handle_change_userpassword(self, request): self.app_logger.debug("handle_change_userpassword") self.checkMandatoryParams(request, ['oldpassword', 'newpassword']) param_dict = request.param_dict ret = Teacher.changePasswordByTeacher(request.user.id, param_dict['oldpassword'], param_dict['newpassword']) return JsonResponse(ret)
def handle_list_teacher(self, request): self.checkMandatoryParams(request, ['pagenum', 'pagesize']) pagenum = int(request.param_dict['pagenum']) pagesize = int(request.param_dict['pagesize']) return JsonResponse(Teacher.list(pagenum, pagesize))
def handle_delete_teacher(self, request): self.checkMandatoryParams(request, ['id']) return JsonResponse(Teacher.deleteOne(request.param_dict['id']))
def handle_modify_teacher(self, request): self.checkMandatoryParams(request, ['id', 'newdata']) newData = json.loads(request.param_dict['newdata']) return JsonResponse(Teacher.modify(request.param_dict['id'], newData))
def handle_add_teacher(self, request): self.checkMandatoryParams(request, ['data']) data = json.loads(request.param_dict['data']) return JsonResponse(Teacher.add(data))
def handle_get_my_info(self, request): teacherid = request.session['teacherid'] ret = Teacher.getone(teacherid) return JsonResponse(ret)
def handle_get_teach_courses(self, request): teacherid = request.session['teacherid'] clist, cidlist = Teacher.get_teach_courses(teacherid) return JsonResponse({'retcode': 0, 'retlist': clist})