Exemple #1
0
def config_list(request, id):
    if request.session.get('login_status'):
        if request.is_ajax():
            test_info = json.loads(request.body.decode('utf-8'))
            if 'status' in test_info.keys():
                msg = change_status(TestCaseInfo, **test_info)
                return HttpResponse(get_ajax_msg(msg, '配置已更改!'))
        else:
            filter_query = set_filter_session(request)
            test_list = get_pager_info(TestCaseInfo, filter_query,
                                       '/api/config_list/', id)
            manage_info = {
                'account': request.session["now_account"],
                'test': test_list[1],
                'page_list': test_list[0],
                'info': filter_query
            }
            return render_to_response('config_list.html', manage_info)
    else:
        return HttpResponseRedirect("/api/login/")
Exemple #2
0
def module_list(request, id):
    if request.session.get('login_status'):
        if request.is_ajax():
            module_info = json.loads(request.body.decode('utf-8'))

            if 'status' in module_info.keys():
                msg = change_status(ModuleInfo, **module_info)
                return HttpResponse(get_ajax_msg(msg, '模块状态已更改!'))
            else:
                msg = module_info_logic(type=False, **module_info)
                return HttpResponse(get_ajax_msg(msg, '模块信息更新成功'))
        else:
            filter_query = set_filter_session(request)
            module_list = get_pager_info(ModuleInfo, filter_query,
                                         '/api/module_list/', id)
            manage_info = {
                'account': request.session["now_account"],
                'module': module_list[1],
                'page_list': module_list[0],
                'info': filter_query
            }
            return render_to_response('module_list.html', manage_info)
    else:
        return HttpResponseRedirect("/api/login/")