def edit_config(request): if request.session.get('login_status'): if request.is_ajax(): testconfig_lists = json.loads(request.body.decode('utf-8')) logger.error('配置更新处理之前数据:{testconfig_lists}'.format( testconfig_lists=testconfig_lists)) msg = config_info_logic(type=False, **testconfig_lists) return HttpResponse(get_ajax_msg(msg, '配置更新成功')) elif request.method == 'POST': id = request.POST.get('id') account = request.POST.get('account') test_info = TestCaseInfo.objects.get_case_by_id(id) request = eval(test_info[0].request) manage_info = { 'account': account, 'info': test_info[0], 'request': request['config'], 'project': ProjectInfo.objects.all().values('project_name').order_by( '-create_time') } return render_to_response('edit_config.html', manage_info) else: return HttpResponseRedirect("/api/login/")
def edit_config(request, id=None): """ 编辑配置 :param request: :param id: :return: """ if request.session.get('login_status'): acount = request.session["now_account"] if request.is_ajax(): try: testconfig_lists = json.loads(request.body.decode('utf-8')) except ValueError: logger.error('配置更新处理之前数据:{testconfig_lists}'.format( testconfig_lists=testconfig_lists)) msg = config_info_logic(type=False, **testconfig_lists) return HttpResponse(get_ajax_msg(msg, '/api/config_list/1/')) config_info = TestCaseInfo.objects.get_case_by_id(id) request = eval(config_info[0].request) manage_info = { 'account': acount, 'info': config_info[0], 'request': request['config'], 'project': ProjectInfo.objects.all().values('project_name').order_by( '-create_time') } return render_to_response('edit_config.html', manage_info) else: return HttpResponseRedirect("/api/login/")
def edit_config(request, id=None): """ 编辑配置 :param request: :param id: :return: """ account = request.session["now_account"] if request.is_ajax(): testconfig_lists = json.loads(request.body.decode('utf-8')) msg = config_info_logic(type=False, **testconfig_lists) return HttpResponse(get_ajax_msg(msg, '/api/config_list/1/')) config_info = TestCaseInfo.objects.get_case_by_id(id) request = eval(config_info[0].request) manage_info = { 'account': account, 'info': config_info[0], 'request': request['config'], 'project': ProjectInfo.objects.all().values( 'project_name').order_by('-create_time'), 'module' : ModuleInfo.objects.all().values().order_by('-create_time') } return render_to_response('edit_config.html', manage_info)
def add_config(request): """ 新增配置 :param request: :return: """ if request.session.get('login_status'): acount = request.session["now_account"] if request.is_ajax(): try: testconfig_info = json.loads(request.body.decode('utf-8')) except ValueError: logger.error('配置信息解析失败:{testconfig_info}'.format( testconfig_info=testconfig_info)) return '配置信息解析异常' msg = config_info_logic(**testconfig_info) return HttpResponse(get_ajax_msg(msg, '/api/config_list/1/')) elif request.method == 'GET': manage_info = { 'account': acount, 'project': ProjectInfo.objects.all().values('project_name').order_by( '-create_time') } return render_to_response('add_config.html', manage_info) else: return HttpResponseRedirect("/api/login/")
def edit_config(request, id=None): """ 编辑配置 :param request: :param id: :return: """ account = request.session["now_account"] user_type = request.session['user_type'] if request.is_ajax(): testconfig_lists = json.loads(request.body.decode('utf-8')) tastcase = testconfig_lists.get('config').get('name') author = tastcase.get('author') project = tastcase.get('project') module = tastcase.get('module') if not validate_operate(account, author, user_type, project, module): return HttpResponse(get_ajax_msg("非创建人或负责人不能修改,请检查", '/api/test_list/1/')) msg = config_info_logic(type=False, **testconfig_lists) return HttpResponse(get_ajax_msg(msg, '/api/config_list/1/')) config_info = TestCaseInfo.objects.get_case_by_id(id) request = eval(config_info[0].request) manage_info = { 'account': account, 'info': config_info[0], 'request': request['config'], 'project': ProjectInfo.objects.all().values( 'project_name').order_by('-create_time') } return render_to_response('edit_config.html', manage_info)
def add_config(request): if request.session.get('login_status'): if request.is_ajax(): testconfig_lists = json.loads(request.body.decode('utf-8')) msg = config_info_logic(**testconfig_lists) return HttpResponse(get_ajax_msg(msg, '配置添加成功')) elif request.method == 'GET': manage_info = { 'account': request.session["now_account"], 'project': ProjectInfo.objects.all().values('pro_name').order_by('-create_time') } return render_to_response('add_config.html', manage_info) else: return HttpResponseRedirect("/api/login/")
def add_config(request): """ 新增配置 :param request: :return: """ account = request.session["now_account"] if request.is_ajax(): testconfig_info = json.loads(request.body.decode('utf-8')) msg = config_info_logic(**testconfig_info) return HttpResponse(get_ajax_msg(msg, '/api/config_list/1/')) elif request.method == 'GET': manage_info = { 'account': account, 'project': ProjectInfo.objects.all().values('project_name').order_by('-create_time') } return render_to_response('add_config.html', manage_info)
def edit_config(request): if request.session.get('login_status'): if request.is_ajax(): testconfig_lists = json.loads(request.body.decode('utf-8')) msg = config_info_logic(type=False, **testconfig_lists) return HttpResponse(get_ajax_msg(msg, '配置更新成功')) elif request.method == 'POST': id = request.POST.get('id') account = request.POST.get('account') test_info = TestCaseInfo.objects.get_case_by_id(id) request = eval(test_info[0].request) manage_info = { 'account': account, 'info': test_info[0], 'request': request['config'] } return render_to_response('edit_config.html', manage_info) else: return HttpResponseRedirect("/api/login/")