Fixed wrong user lookup in toggle_follow

This commit is contained in:
Fergal Moran
2013-05-03 16:27:04 +01:00
parent 97acef1884
commit c4083ef2e6
3 changed files with 9 additions and 5 deletions

View File

@@ -178,7 +178,7 @@ def toggle_follow(request):
try:
if request.is_ajax() and request.method == 'POST' and 'userId' in request.POST:
profile = request.user.get_profile()
following = UserProfile.objects.get(pk=request.POST['userId'])
following = UserProfile.objects.get(user__id=request.POST['userId'])
if following is not None:
if profile.followers is None or (following not in profile.followers.all()):
profile.add_follower(following)