Example #1
0
    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))
Example #2
0
    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)
Example #3
0
 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))
Example #4
0
 def handle_delete_teacher(self, request):
     self.checkMandatoryParams(request, ['id'])
     return JsonResponse(Teacher.deleteOne(request.param_dict['id']))
Example #5
0
 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))
Example #6
0
 def handle_add_teacher(self, request):
     self.checkMandatoryParams(request, ['data'])
     data = json.loads(request.param_dict['data'])
     return JsonResponse(Teacher.add(data))
Example #7
0
    def handle_get_my_info(self, request):

        teacherid = request.session['teacherid']
        ret = Teacher.getone(teacherid)

        return JsonResponse(ret)
Example #8
0
    def handle_get_teach_courses(self, request):
        teacherid = request.session['teacherid']
        clist, cidlist = Teacher.get_teach_courses(teacherid)

        return JsonResponse({'retcode': 0, 'retlist': clist})