'how can i use filter to check if specific user's social media link is correct?
def userProfile(request, pk):
user = User.objects.get(id=pk)
rooms = user.room_set.all()
room_messages = user.message_set.all()
topics = Topic.objects.all()
link_fb = User.objects.filter(Q(link_fb__icontains='facebook'))
link_ig = User.objects.filter(Q(link_ig__icontains='instagram'))
link_lin = User.objects.filter(Q(link_lin__icontains='linkedin'))
context = {'user': user, 'rooms': rooms, 'room_messages': room_messages,
'topics': topics, 'link_fb': link_fb, 'link_ig': link_ig,
'link_lin': link_lin}
return render(request, 'base/profile.html', context)
I've got something like this. I want to check if url is correct. Problem is i can not get specific user and then use filter. Is there any other way to do that?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
