def project_list(request, id): if request.session.get('login_status'): if request.is_ajax(): try: project_info = json.loads(request.body.decode('utf-8')) except ValueError: logging.debug('项目信息解析异常:{project_info}'.format( project_info=project_info)) return HttpResponse('项目信息解析异常') if 'mode' in project_info.keys(): msg = del_project_data(project_info.pop('id')) else: msg = project_info_logic(type=False, **project_info) return HttpResponse(get_ajax_msg(msg, 'ok')) else: filter_query = set_filter_session(request) pro_list = get_pager_info(ProjectInfo, filter_query, '/api/project_list/', id) manage_info = { 'account': request.session["now_account"], 'project': pro_list[1], 'page_list': pro_list[0], 'info': filter_query, 'sum': pro_list[2], 'env': EnvInfo.objects.all().order_by('-create_time') } return render_to_response('project_list.html', manage_info) else: return HttpResponseRedirect("/api/login/")
def project_list(request, id): """ 项目列表 :param request: :param id: str or int:当前页 :return: """ account = request.session["now_account"] if request.is_ajax(): project_info = json.loads(request.body.decode('utf-8')) if 'mode' in project_info.keys(): msg = del_project_data(project_info.pop('id')) else: msg = project_info_logic(type=False, **project_info) return HttpResponse(get_ajax_msg(msg, 'ok')) else: filter_query = set_filter_session(request) pro_list = get_pager_info( ProjectInfo, filter_query, '/api/project_list/', id) manage_info = { 'account': account, 'project': pro_list[1], 'page_list': pro_list[0], 'info': filter_query, 'sum': pro_list[2], 'env': EnvInfo.objects.all().order_by('-create_time'), 'project_all': ProjectInfo.objects.all().order_by('-update_time') } return render_to_response('project_list.html', manage_info)
def add_project(request): if request.session.get('login_status'): if request.is_ajax(): project_info = json.loads(request.body.decode('utf-8')) msg = project_info_logic(**project_info) return HttpResponse(get_ajax_msg(msg, '项目添加成功')) elif request.method == 'GET': manage_info = {'account': request.session["now_account"]} return render_to_response('add_project.html', manage_info) else: return HttpResponseRedirect("/api/login/")
def add_project(request): """ 新增项目 :param request: :return: """ account = request.session["now_account"] if request.is_ajax(): project_info = json.loads(request.body.decode('utf-8')) msg = project_info_logic(**project_info) return HttpResponse(get_ajax_msg(msg, '/api/project_list/1/')) elif request.method == 'GET': manage_info = {'account': account} return render_to_response('add_project.html', manage_info)
def add_project(request): if request.session.get('login_status'): if request.is_ajax(): try: project_info = json.loads(request.body.decode('utf-8')) except ValueError: logger.error('项目信息解析异常: {project_info}'.format( project_info=project_info)) return HttpResponse('项目信息新增异常') msg = project_info_logic(**project_info) return HttpResponse(get_ajax_msg(msg, '项目添加成功')) elif request.method == 'GET': manage_info = {'account': request.session["now_account"]} return render_to_response('add_project.html', manage_info) else: return HttpResponseRedirect("/api/login/")
def add_project(request): """ 新增项目 :param request: :return: """ account = request.session["now_account"] if request.is_ajax(): project_info = json.loads(request.body.decode('utf-8')) project_info['creator'] = account msg = project_info_logic(**project_info) return HttpResponse(get_ajax_msg(msg, '/api/project_list/1/')) elif request.method == 'GET': manage_info = { 'account': account, 'configs': TestCaseInfo.objects.filter(type=2).order_by('-create_time') } return render_to_response('add_project.html', manage_info)
def project_list(request, id): if request.session.get('login_status'): if request.is_ajax(): project_info = json.loads(request.body.decode('utf-8')) if 'status' in project_info.keys(): msg = change_status(ProjectInfo, **project_info) return HttpResponse(get_ajax_msg(msg, '项目状态已更改!')) else: msg = project_info_logic(type=False, **project_info) return HttpResponse(get_ajax_msg(msg, '项目信息更新成功')) else: filter_query = set_filter_session(request) pro_list = get_pager_info(ProjectInfo, filter_query, '/api/project_list/', id) manage_info = { 'account': request.session["now_account"], 'project': pro_list[1], 'page_list': pro_list[0], 'info': filter_query } return render_to_response('project_list.html', manage_info) else: return HttpResponseRedirect("/api/login/")