Exemplo n.º 1
0
            if len(qs):
                print qs[0].adm3
                #EffortInstanceObj.adm_3 = qs[0]
                EffortInstanceObj.adm_3 = haiti_adm3_minustah.objects.get(
                    id=qs[0].id)

        EffortInstanceObj.save()

        for x in hacServiceCols:
            #print "now going through column "+str(x) +" which is "+str(hacHeaders[x])
            #makes sure column has that service type (1 would be the value)
            if row[x] == '1':
                #print row[x]
                #if hacServiceCols[x] != "0":
                #	print "service "+str(x) +" is not equal to 1"
                EffortInstanceServiceObj = EffortInstanceService()
                EffortInstanceServiceObj.effort_instance = EffortInstance.objects.get(
                    effort_instance_id=row[0])

                #EffortInstanceServiceObj.effort_service_description = upfirstletter(hacHeaders[x].replace("_", " "));
                effort_service_description = upfirstletter(
                    hacHeaders[x].replace("_", " "))
                '''
				#classify EffortInstanceServiceObj.effort_service_description based on a dictionary
				if ServiceType.objects.filter(service_name_en=classify_service_types[EffortInstanceServiceObj.effort_service_description]).count() == 1:
					serviceType = ServiceType.objects.get(service_name_en=classify_service_types[EffortInstanceServiceObj.effort_service_description])
					EffortInstanceServiceObj.effort_service_type = serviceType
				'''

                if ServiceType.objects.filter(
                        service_name_en=classify_service_types[
Exemplo n.º 2
0
	
		#need a way first in seeing if a location exists close by
		#EffortInstanceObj.location = loc.objects.get
		EffortInstanceObj.save()
		
		#looking at specialities column
		if row[3]:
			#print row[3]
			
			
			ServiceTypeSplit = re.split(r',', row[3].strip())
			print ServiceTypeSplit
			for x in range(0,len(ServiceTypeSplit)):
				
				
				EffortInstanceServiceObj = EffortInstanceService()
				EffortInstanceServiceObj.effort_instance = EffortInstance.objects.get(effort_instance_id=row[0])
				
				#EffortInstanceServiceObj.effort_service_description = ServiceTypeSplit[x].strip()
				effort_service_description = ServiceTypeSplit[x].strip()
				
				#print EffortInstanceServiceObj.effort_service_description
				
				#classify EffortInstanceServiceObj.effort_service_description based on a dictionary
				#EffortInstanceServiceObj.effort_service_type = ServiceType.objects.get(service_name_en=classify_service_types[EffortInstanceServiceObj.effort_service_description])
				EffortInstanceServiceObj.effort_service_type = ServiceType.objects.get(service_name_en=classify_service_types[effort_service_description])
				
				EffortInstanceServiceObj.save()	
			
		
Exemplo n.º 3
0
			
			if len(qs):
				print qs[0].adm3
				#EffortInstanceObj.adm_3 = qs[0]
				EffortInstanceObj.adm_3 = haiti_adm3_minustah.objects.get(id=qs[0].id)
				
		EffortInstanceObj.save()
		
		for x in hacServiceCols:
			#print "now going through column "+str(x) +" which is "+str(hacHeaders[x])
			#makes sure column has that service type (1 would be the value)
			if row[x] == '1':
			#print row[x]
				#if hacServiceCols[x] != "0":
				#	print "service "+str(x) +" is not equal to 1"
				EffortInstanceServiceObj = EffortInstanceService()
				EffortInstanceServiceObj.effort_instance = EffortInstance.objects.get(effort_instance_id=row[0])
		
				#EffortInstanceServiceObj.effort_service_description = upfirstletter(hacHeaders[x].replace("_", " "));
				effort_service_description = upfirstletter(hacHeaders[x].replace("_", " "));
		
				'''
				#classify EffortInstanceServiceObj.effort_service_description based on a dictionary
				if ServiceType.objects.filter(service_name_en=classify_service_types[EffortInstanceServiceObj.effort_service_description]).count() == 1:
					serviceType = ServiceType.objects.get(service_name_en=classify_service_types[EffortInstanceServiceObj.effort_service_description])
					EffortInstanceServiceObj.effort_service_type = serviceType
				'''
				
				if ServiceType.objects.filter(service_name_en=classify_service_types[effort_service_description]).count() == 1:
					serviceType = ServiceType.objects.get(service_name_en=classify_service_types[effort_service_description])
					EffortInstanceServiceObj.effort_service_type = serviceType