Exemple #1
0
def connect(request):
	u1 = request.user
	u2 = User.objects.get(id=request.POST.get('id'))
	response = {}

	try:
		cxn1 = Connection()
		cxn1.person1 = u1.profile
		cxn1.person2 = u2.profile
		cxn1.service = "linkedin"
		cxn1.status = "added"
		cxn1.save()

		cxn2 = Connection()
		cxn2.person1 = u1.profile
		cxn2.person2 = u2.profile
		cxn2.service = "linkedin"
		cxn2.status = "added"
		cxn2.save()

		response["result"] = "success"
	except:
		response["result"] = "failure"
		response["errors"] = "Error creating connections @ DB"

	return HttpResponse(simplejson.dumps(response))
Exemple #2
0
	def add_connection(self,user1,user2):
		"""
		Adds connections between users
		"""
		cxn = Connection()
		cxn.person1 = user1.profile
		cxn.person2 = user2.profile
		cxn.service = "linkedin"
		cxn.save()

		cxn = Connection()
		cxn.person1 = user2.profile
		cxn.person2 = user1.profile
		cxn.service = "linkedin"
		cxn.save()