Exemplo n.º 1
0
def create_parents():
	for k in mapper.keys():
		try:
			parent = Career.objects.get(long_name=k)
		except:
			parent = Career()
			parent.long_name = k
			parent.short_name = k
			parent.description = "parent"
			parent.save()
			print "Parent Career created: " + parent.long_name
Exemplo n.º 2
0
	def import_careers_from_url(self,path):

		data = urllib2.urlopen(path).read()
		c = csv.DictReader([data])
		for row in c:
			career = Career()
			career.short_name = row['short_name']
			career.long_name = row['long_name']
			career.save()
			if row['titles'] is not None and row['titles'] is not "":
				new_titles = row['titles'].split(',')
				for t in new_titles:
					career.add_pos_title(t)
			career.save()
Exemplo n.º 3
0
	def import_careers_from_file(self,path):

		f = open(path,'rU')
		c = csv.DictReader(f)
		for row in c:
			career = Career()
			career.short_name = row['short_name']
			career.long_name = row['long_name']
			career.save()
			if row['titles'] is not None and row['titles'] is not "":
				new_titles = row['titles'].split(',')
				for t in new_titles:
					career.add_pos_title(t)
			career.save()