Fix unfollow url syntax in view

This commit is contained in:
Mouse Reeve 2020-02-19 11:38:42 -08:00
parent 08933c9009
commit 3692fe5151

View file

@ -286,11 +286,11 @@ def follow(request, username):
@login_required @login_required
def unfollow(request): def unfollow(request, username):
''' unfollow a user ''' ''' unfollow a user '''
user = request.user to_unfollow = models.User.objects.get(username=username)
to_unfollow = models.User.objects.get(id=request.POST.get('user'))
outgoing.handle_outgoing_unfollow(user, to_unfollow) outgoing.handle_outgoing_unfollow(request.user, to_unfollow)
user_slug = to_unfollow.localname if to_unfollow.localname \ user_slug = to_unfollow.localname if to_unfollow.localname \
else to_unfollow.username else to_unfollow.username
return redirect('/user/%s' % user_slug) return redirect('/user/%s' % user_slug)