@login_required
def transfer(request, code):
    check = _get_rw_check_for_user(request, code)
    if (request.method == 'POST'):
        target_project = _get_rw_project_for_user(request, request.POST['project'])
        if (target_project.num_checks_available() <= 0):
            return HttpResponseBadRequest()
        check.project = target_project
        check.save()
        check.assign_all_channels()
        messages.success(request, 'Check transferred successfully!')
        return redirect('hc-details', code)
    ctx = {'check': check}
    return render(request, 'front/transfer_modal.html', ctx)
@login_required
def transfer(request, code):
    check = _get_rw_check_for_user(request, code)
    if (request.method == 'POST'):
        target_project = _get_rw_project_for_user(request, request.POST['project'])
        if (target_project.num_checks_available() <= 0):
            return HttpResponseBadRequest()
        check.project = target_project
        check.save()
        check.assign_all_channels()
        messages.success(request, 'Check transferred successfully!')
        return redirect('hc-details', code)
    ctx = {'check': check}
    return render(request, 'front/transfer_modal.html', ctx)