def index(request): """ 首页 :param request: :return: """ project_length = ProjectInfo.objects.count() module_length = ModuleInfo.objects.count() test_length = TestCaseInfo.objects.filter(type__exact=1).count() suite_length = TestSuite.objects.count() total = get_total_values() init_filter_session(request) user_list = UserInfo.objects.values_list('username').distinct() dictUserCase = get_casesNum_by_user(user_list) manage_info = { 'project_length': project_length, 'module_length': module_length, 'test_length': test_length, 'suite_length': suite_length, 'account': request.session["now_account"], 'total': total, 'dictUserCase': dictUserCase } return render_to_response('index.html', manage_info)
def index(request): """ 首页 :param request: :return: """ if request.session.get('login_status'): project_length = ProjectInfo.objects.count() module_length = ModuleInfo.objects.count() test_length = TestCaseInfo.objects.filter(type__exact=1).count() suite_length = TestSuite.objects.count() total = get_total_values() manage_info = { 'project_length': project_length, 'module_length': module_length, 'test_length': test_length, 'suite_length': suite_length, 'account': request.session["now_account"], 'total': total } init_filter_session(request) return render_to_response('index.html', manage_info) else: return HttpResponseRedirect("/api/login/")
def log_out(request): """ 注销登录 :param request: :return: """ if request.method == 'GET': logger.info('{username}退出'.format(username=request.session['now_account'])) try: del request.session['now_account'] del request.session['login_status'] init_filter_session(request, type=False) except KeyError: logging.error('session invalid') return HttpResponseRedirect("/api/login/")
def index(request): """ 首页展示 :param request: :return: """ project_length = ProjectInfo.objects.count() # 项目数量 module_length = ModuleInfo.objects.count() # 模块数量 test_length = TestCaseInfo.objects.filter(type__exact=1).count() # 测试用例数 suite_length = TestSuite.objects.count() # 用例集合数 total = get_total_values() manage_info = { 'project_length': project_length, 'module_length': module_length, 'test_length': test_length, 'suite_length': suite_length, 'account': request.session["now_account"], 'total': total } init_filter_session(request) return render_to_response('index.html', manage_info)