def change_friend(request, operation, username): new_friend = User.objects.get(username=username) if operation == 'add': Profile.add_friend(request.user, new_friend) elif operation == 'del': Profile.del_friend(request.user, new_friend) return redirect('/')