login_required def add_to_profile request output API_KEY settings FACE

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
@login_required
def add_to_profile(request):
output = {'API_KEY': settings.FACEBOOK_API_KEY}
facebook_id = int(request.COOKIES.get('%s_user' % settings.FACEBOOK_API_KEY))
try:
fb = FacebookProfile.objects.get(facebook_id = facebook_id)
except FacebookProfile.DoesNotExist:
facebook_profile = FacebookProfile(profile=request.user,
facebook_id = facebook_id)
facebook_profile.save()
return HttpResponseRedirect(reverse('facebook_login'))