def close_or_open(request, pk, close=True):
    # todo: moderators should be able to close it
    poll = get_object_or_404(
        CommentPoll,
        pk=pk,
        comment__user=request.user
    )

    if close:
        close_at = timezone.now()
    else:
        close_at = None

    (CommentPoll.objects
     .filter(pk=poll.pk)
     .update(close_at=close_at))

    return redirect(request.GET.get('next', poll.get_absolute_url()))
A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks.