def get_system_specs(request): instance_types = specs_helper.get_instance_types(request) security_groups = specs_helper.get_security_groups(request) subnets = specs_helper.get_subnets(request) sorted_subnets = sorted(subnets, key=lambda subnet: subnet["info"]["tag"]) sorted_sgs = sorted(security_groups, key=lambda sg: sg["info"]["name"]) return instance_types, sorted_subnets, sorted_sgs
def get_sg_settings(request): security_groups = specs_helper.get_security_groups(request) sorted_sgs = sorted(security_groups, key=lambda sg: sg["info"]["name"]) curr_sg = request.GET.get("curr_sg", "") contents = render_to_string("groups/get_sg.tmpl", {"security_groups": sorted_sgs, "curr_sg": curr_sg}) return HttpResponse(json.dumps(contents), content_type="application/json")