def get(self, request): index = int(request.GET.get('page_index', '1')) size = int(request.GET.get('page_size', DEFAULT_PAGE_SIZE)) names = environs_helper.get_all_env_names(request, index=index, size=size) return render(request, 'environs/envs_landing.html', { "names": names, "pageIndex": index, "pageSize": DEFAULT_PAGE_SIZE, "disablePrevious": index <= 1, "disableNext": len(names) < DEFAULT_PAGE_SIZE, })
def get(self, request): index = int(request.GET.get('page_index', '1')) size = int(request.GET.get('page_size', DEFAULT_PAGE_SIZE)) names = environs_helper.get_all_env_names(request, index=index, size=size) return render( request, 'environs/envs_landing.html', { "names": names, "pageIndex": index, "pageSize": DEFAULT_PAGE_SIZE, "disablePrevious": index <= 1, "disableNext": len(names) < DEFAULT_PAGE_SIZE, })
def search_envs(request, filter): max_size = 10000 names = environs_helper.get_all_env_names(request, name_filter=filter, index=1, size=max_size) if not names: return redirect('/envs/') if len(names) == 1: return redirect('/env/%s/' % names[0]) return render(request, 'environs/envs_landing.html', { "names": names, "pageIndex": 1, "pageSize": DEFAULT_PAGE_SIZE, "disablePrevious": True, "disableNext": True, })
def search_envs(request, filter): max_size = 10000 names = environs_helper.get_all_env_names(request, name_filter=filter, index=1, size=max_size) if not names: return redirect('/envs/') if len(names) == 1: return redirect('/env/%s/' % names[0]) return render( request, 'environs/envs_landing.html', { "names": names, "pageIndex": 1, "pageSize": DEFAULT_PAGE_SIZE, "disablePrevious": True, "disableNext": True, })
def get_env_names(request): # TODO create a loop to get all names max_size = 10000 names = environs_helper.get_all_env_names(request, index=1, size=max_size) return HttpResponse(json.dumps(names), content_type="application/json")