def getdetails(request): regionName = request.REQUEST.get("name", "") regionInfo = None redirectURL = '/cloudman/message/?msg=' ## Get the region object try: regionInfo = Region.objects.select_related('admin_group').get(name=regionName) except Region.DoesNotExist: errorMessage = 'Region Name ' + regionName + ' does not exists' return HttpResponseRedirect(redirectURL + errorMessage) ## Get the zones information located in this region zonesInfo = Zone.objects.filter(region__name = regionName).order_by('name') ## Get the allowed resource types information for all the zones present in this region allowedResourceTypesList = ZoneAllowedResourceType.objects.select_related('resource_type','zone').filter(zone__region__name=regionName).order_by('resource_type__name') object_id = regionInfo.id changeLogList = getLog('region',regionName,object_id,None) return render_to_response('region/getdetails.html',locals(),context_instance=RequestContext(request))
def getdetails(request): resourceTypeName = request.REQUEST.get("name", "") resourceTypeInfo = None redirectURL = '/cloudman/message/?msg=' ## Get the Resource Type Object with the given name try: resourceTypeInfo = ResourceType.objects.get(name=resourceTypeName) except ResourceType.DoesNotExist: errorMessage = 'Resource Type with Name ' + resourceTypeName + ' does not exists' return HttpResponseRedirect(redirectURL + errorMessage) ## Get all the Zones which are allowed to have this resource type zoneNames = ZoneAllowedResourceType.objects.filter(resource_type__name__iexact = resourceTypeName).values_list('zone__name', 'zone__region__name').order_by('zone__name') zoneNamesList = list(zoneNames) ## Get the Top Level Allocation Names who has this resource type in its allowed category tpAllocNames = TopLevelAllocationAllowedResourceType.objects.filter(resource_type__name__iexact = resourceTypeName).values_list('top_level_allocation__name', flat=True).order_by('top_level_allocation__name') ## Get the Project Allocation Names whos ha this resource type in its allowed category prAllocNames = ProjectAllocationAllowedResourceType.objects.filter(resource_type__name__iexact = resourceTypeName).values_list('project_allocation__name', flat=True).order_by('project_allocation__name') ## Get the Group Allocation Names who has this resource type in its allowed category grAllocNames = GroupAllocationAllowedResourceType.objects.filter(resource_type__name__iexact = resourceTypeName).values_list('group_allocation__name', flat=True).order_by('group_allocation__name') object_id = resourceTypeInfo.id changeLogList = getLog('resourcetype',resourceTypeName,object_id,None) return render_to_response('resourcetype/getdetails.html',locals(),context_instance=RequestContext(request))