Closed R0b3rt020 closed 2 years ago
No, I just looked through things and there isn't. I think we left that as an exercise for the user because how that might work can easily differ across projects. Maybe you can't remove friendships? Maybe the other party gets notified, maybe they don't. etc.
I wouldn't be opposed to adding a view for it if you wanted to contribute one.
Similar to remove follow:
@login_required
def friendship_remove(
request, friend_username, template_name="friendship/friend/remove.html"
):
""" Remove a friend relationship """
if request.method == "POST":
friend_to_remove = user_model.objects.get(username=friend_username)
friend_request = request.user
Friend.objects.remove_friend(friend_to_remove,friend_request)
return redirect("friendship_view_friends", request.user)
return render(request, template_name, {"friend_username": friend_username})
Is there any view already made for remove_friend function in models?