I am working on a website using Django. I'm having a difficult time playing around codes, how do I get the ID of a user without passing a primary key (id, pk) in the URL. My code below does not give me a solution to getting the ID of a particular user. When I print (user) it prints the current user logged in. Is there a way to get the ID of other users?
def home(request):
p=Profile.object.filter(user=request.user)
u=p.user
send_request=FriendRequest.objects.filter(from_user=p.user)
def send_request(request, id):
user=get_object_or_404(User, id=id)
frequest=FriendRequest.get_or_creat(from_user=request.user, to_user=user).first()
path('home', home_view, name='home')
<a href='{% url 'site:send_request' profile.user.id %}'>Add friend<a>