Пример #1
0
def get_tours(request):
    host_id = request.POST.get('id')
    server_url = request.POST.get('server_url')
    tours = ron_api.read_tours(host_id, server_url)

    response_data = {
        'tours': tours,
    }

    return JsonResponse(response_data)
Пример #2
0
def get_all_host_info(request):
    parameters = request.POST['parameters']
    host_id = request.POST['parameters'].split(',')[0]
    host_ids_checkbox = request.POST['host_ids_checkbox'] == 'true'
    tour_names_checkbox = request.POST['tour_names_checkbox'] == 'true'
    tour_codes_checkbox = request.POST['tour_codes_checkbox'] == 'true'
    basis_name_checkbox = request.POST['basis_name_checkbox'] == 'true'
    basis_checkbox = request.POST['basis_checkbox'] == 'true'
    sub_basis_name_checkbox = request.POST['sub_basis_name_checkbox'] == 'true'
    sub_basis_checkbox = request.POST['sub_basis_checkbox'] == 'true'
    time_ids_checkbox = request.POST['time_ids_checkbox'] == 'true'
    pickup_keys_checkbox = request.POST['pickup_keys_checkbox'] == 'true'
    server_url = request.POST.get('server_url')
    data_level = request.POST['data_level']
    csv_separator = request.POST.get('csv_separator')

    csv_content = ""

    if host_ids_checkbox:
        csv_content += "Host" + csv_separator
    if tour_names_checkbox:
        csv_content += "Tour Name" + csv_separator
    if tour_codes_checkbox:
        csv_content += "Tour Code" + csv_separator
    if basis_name_checkbox:
        csv_content += "Basis Name" + csv_separator
    if basis_checkbox:
        csv_content += "Basis" + csv_separator
    if sub_basis_name_checkbox:
        csv_content += "Sub Basis Name" + csv_separator
    if sub_basis_checkbox:
        csv_content += "Sub Basis" + csv_separator
    if time_ids_checkbox:
        csv_content += "Time ID" + csv_separator
    if pickup_keys_checkbox:
        csv_content += "Pickup Key\n"
    else:
        csv_content += "\n"

    if data_level == "1":
        tours = ron_api.read_tours(host_id, server_url)
        if pickup_keys_checkbox:
            for tour_codes in tours:
                tour_bases = ron_api.read_tour_bases(host_id, tour_codes['strTourCode'], server_url)

                for tour_base in tour_bases:

                    tour_times = ron_api.read_tour_times(host_id, tour_codes['strTourCode'], server_url)

                    for tour_time in tour_times:
                        basis_name = tour_base['strBasisDesc']
                        basis_id = tour_base['intBasisID']
                        sub_basis_name = tour_base['strSubBasisDesc']
                        sub_basis_id = tour_base['intSubBasisID']
                        time_id = tour_time['intTourTimeID']
                        tour_pickups = ron_api.read_tour_pickups(host_id, tour_codes['strTourCode'], time_id, basis_id,
                                                                 server_url)

                        for tour_pickup in tour_pickups:
                            pickup_key = tour_pickup['strPickupKey']

                            if host_ids_checkbox:
                                csv_host_id = str(host_id) + csv_separator
                            else:
                                csv_host_id = ""
                            if tour_names_checkbox:
                                csv_tour_name = str(tour_codes['strTourName']).replace(',', '') + csv_separator
                            else:
                                csv_tour_name = ""
                            if tour_codes_checkbox:
                                csv_tour_code = str(tour_codes['strTourCode']) + csv_separator
                            else:
                                csv_tour_code = ""
                            if basis_name_checkbox:
                                csv_basis_name = str(basis_name).replace(',', '') + csv_separator
                            else:
                                csv_basis_name = ""
                            if basis_checkbox:
                                csv_basis_id = str(basis_id) + csv_separator
                            else:
                                csv_basis_id = ""
                            if sub_basis_name_checkbox:
                                csv_sub_basis_name = str(sub_basis_name).replace(',', '') + csv_separator
                            else:
                                csv_sub_basis_name = ""
                            if sub_basis_checkbox:
                                csv_sub_basis_id = str(sub_basis_id) + csv_separator
                            else:
                                csv_sub_basis_id = ""
                            if time_ids_checkbox:
                                csv_time_id = str(time_id) + csv_separator
                            else:
                                csv_time_id = ""

                            csv_content += csv_host_id + csv_tour_name + csv_tour_code + csv_basis_name + csv_basis_id + csv_sub_basis_name + csv_sub_basis_id + csv_time_id + str(
                                pickup_key) + "\n"

        elif time_ids_checkbox:
            for tour_codes in tours:
                tour_bases = ron_api.read_tour_bases(host_id, tour_codes['strTourCode'], server_url)

                for tour_base in tour_bases:

                    tour_times = ron_api.read_tour_times(host_id, tour_codes['strTourCode'], server_url)

                    for tour_time in tour_times:
                        basis_name = tour_base['strBasisDesc']
                        basis_id = tour_base['intBasisID']
                        sub_basis_name = tour_base['strSubBasisDesc']
                        sub_basis_id = tour_base['intSubBasisID']
                        time_id = tour_time['intTourTimeID']

                        if host_ids_checkbox:
                            csv_host_id = str(host_id) + csv_separator
                        else:
                            csv_host_id = ""
                        if tour_names_checkbox:
                            csv_tour_name = str(tour_codes['strTourName']).replace(',', '') + csv_separator
                        else:
                            csv_tour_name = ""
                        if tour_codes_checkbox:
                            csv_tour_code = str(tour_codes['strTourCode']) + csv_separator
                        else:
                            csv_tour_code = ""
                        if basis_name_checkbox:
                            csv_basis_name = str(basis_name).replace(',', '') + csv_separator
                        else:
                            csv_basis_name = ""
                        if basis_checkbox:
                            csv_basis_id = str(basis_id) + csv_separator
                        else:
                            csv_basis_id = ""
                        if sub_basis_name_checkbox:
                            csv_sub_basis_name = str(sub_basis_name).replace(',', '') + csv_separator
                        else:
                            csv_sub_basis_name = ""
                        if sub_basis_checkbox:
                            csv_sub_basis_id = str(sub_basis_id) + csv_separator
                        else:
                            csv_sub_basis_id = ""
                        if time_ids_checkbox:
                            csv_time_id = str(time_id) + csv_separator
                        else:
                            csv_time_id = ""

                        csv_content += (
                                           csv_host_id + csv_tour_name + csv_tour_code + csv_basis_name + csv_basis_id + csv_sub_basis_name + csv_sub_basis_id + csv_time_id).rstrip(
                            csv_separator) + "\n"

        elif basis_checkbox | basis_name_checkbox | sub_basis_checkbox | sub_basis_name_checkbox:
            for tour_codes in tours:
                tour_bases = ron_api.read_tour_bases(host_id, tour_codes['strTourCode'], server_url)

                for tour_base in tour_bases:
                    basis_name = tour_base['strBasisDesc']
                    basis_id = tour_base['intBasisID']
                    sub_basis_name = tour_base['strSubBasisDesc']
                    sub_basis_id = tour_base['intSubBasisID']

                    if host_ids_checkbox:
                        csv_host_id = str(host_id) + csv_separator
                    else:
                        csv_host_id = ""
                    if tour_names_checkbox:
                        csv_tour_name = str(tour_codes['strTourName']).replace(',', '') + csv_separator
                    else:
                        csv_tour_name = ""
                    if tour_codes_checkbox:
                        csv_tour_code = str(tour_codes['strTourCode']) + csv_separator
                    else:
                        csv_tour_code = ""
                    if basis_name_checkbox:
                        csv_basis_name = str(basis_name).replace(',', '') + csv_separator
                    else:
                        csv_basis_name = ""
                    if basis_checkbox:
                        csv_basis_id = str(basis_id) + csv_separator
                    else:
                        csv_basis_id = ""
                    if sub_basis_name_checkbox:
                        csv_sub_basis_name = str(sub_basis_name).replace(',', '') + csv_separator
                    else:
                        csv_sub_basis_name = ""
                    if sub_basis_checkbox:
                        csv_sub_basis_id = str(sub_basis_id) + csv_separator
                    else:
                        csv_sub_basis_id = ""

                    csv_content += (
                                       csv_host_id + csv_tour_name + csv_tour_code + csv_basis_name + csv_basis_id + csv_sub_basis_name + csv_sub_basis_id).rstrip(
                        csv_separator) + "\n"
        elif tour_codes_checkbox | tour_names_checkbox:
            for tour_codes in tours:

                if host_ids_checkbox:
                    csv_host_id = str(host_id) + csv_separator
                else:
                    csv_host_id = ""
                if tour_names_checkbox:
                    csv_tour_name = str(tour_codes['strTourName']).replace(',', '') + csv_separator
                else:
                    csv_tour_name = ""
                if tour_codes_checkbox:
                    csv_tour_code = str(tour_codes['strTourCode']) + csv_separator
                else:
                    csv_tour_code = ""

                csv_content += (csv_host_id + csv_tour_name + csv_tour_code).rstrip(csv_separator) + "\n"
        elif host_ids_checkbox:
            csv_content += host_id + "\n"
    elif data_level == "2":
        tour_name = parameters.split(',')[1]
        tour_code = parameters.split(',')[2]
        if pickup_keys_checkbox:
            tour_bases = ron_api.read_tour_bases(host_id, tour_code, server_url)

            for tour_base in tour_bases:

                tour_times = ron_api.read_tour_times(host_id, tour_code, server_url)

                for tour_time in tour_times:
                    basis_name = tour_base['strBasisDesc']
                    basis_id = tour_base['intBasisID']
                    sub_basis_name = tour_base['strSubBasisDesc']
                    sub_basis_id = tour_base['intSubBasisID']
                    time_id = tour_time['intTourTimeID']
                    tour_pickups = ron_api.read_tour_pickups(host_id, tour_code, time_id, basis_id,
                                                             server_url)

                    for tour_pickup in tour_pickups:
                        pickup_key = tour_pickup['strPickupKey']

                        if host_ids_checkbox:
                            csv_host_id = str(host_id) + csv_separator
                        else:
                            csv_host_id = ""
                        if tour_names_checkbox:
                            csv_tour_name = str(tour_name).replace(',', '') + csv_separator
                        else:
                            csv_tour_name = ""
                        if tour_codes_checkbox:
                            csv_tour_code = str(tour_code) + csv_separator
                        else:
                            csv_tour_code = ""
                        if basis_name_checkbox:
                            csv_basis_name = str(basis_name).replace(',', '') + csv_separator
                        else:
                            csv_basis_name = ""
                        if basis_checkbox:
                            csv_basis_id = str(basis_id) + csv_separator
                        else:
                            csv_basis_id = ""
                        if sub_basis_name_checkbox:
                            csv_sub_basis_name = str(sub_basis_name).replace(',', '') + csv_separator
                        else:
                            csv_sub_basis_name = ""
                        if sub_basis_checkbox:
                            csv_sub_basis_id = str(sub_basis_id) + csv_separator
                        else:
                            csv_sub_basis_id = ""
                        if time_ids_checkbox:
                            csv_time_id = str(time_id) + csv_separator
                        else:
                            csv_time_id = ""

                        csv_content += csv_host_id + csv_tour_name + csv_tour_code + csv_basis_name + csv_basis_id + csv_sub_basis_name + csv_sub_basis_id + csv_time_id + str(
                            pickup_key) + "\n"

        elif time_ids_checkbox:
            tour_bases = ron_api.read_tour_bases(host_id, tour_code, server_url)

            for tour_base in tour_bases:

                tour_times = ron_api.read_tour_times(host_id, tour_code, server_url)

                for tour_time in tour_times:
                    basis_name = tour_base['strBasisDesc']
                    basis_id = tour_base['intBasisID']
                    sub_basis_name = tour_base['strSubBasisDesc']
                    sub_basis_id = tour_base['intSubBasisID']
                    time_id = tour_time['intTourTimeID']

                    if host_ids_checkbox:
                        csv_host_id = str(host_id) + csv_separator
                    else:
                        csv_host_id = ""
                    if tour_names_checkbox:
                        csv_tour_name = str(tour_name).replace(',', '') + csv_separator
                    else:
                        csv_tour_name = ""
                    if tour_codes_checkbox:
                        csv_tour_code = str(tour_code) + csv_separator
                    else:
                        csv_tour_code = ""
                    if basis_name_checkbox:
                        csv_basis_name = str(basis_name).replace(',', '') + csv_separator
                    else:
                        csv_basis_name = ""
                    if basis_checkbox:
                        csv_basis_id = str(basis_id) + csv_separator
                    else:
                        csv_basis_id = ""
                    if sub_basis_name_checkbox:
                        csv_sub_basis_name = str(sub_basis_name).replace(',', '') + csv_separator
                    else:
                        csv_sub_basis_name = ""
                    if sub_basis_checkbox:
                        csv_sub_basis_id = str(sub_basis_id) + csv_separator
                    else:
                        csv_sub_basis_id = ""
                    if time_ids_checkbox:
                        csv_time_id = str(time_id) + csv_separator
                    else:
                        csv_time_id = ""

                    csv_content += (
                                       csv_host_id + csv_tour_name + csv_tour_code + csv_basis_name + csv_basis_id + csv_sub_basis_name + csv_sub_basis_id + csv_time_id).rstrip(
                        csv_separator) + "\n"

        elif basis_checkbox | sub_basis_checkbox | basis_name_checkbox | sub_basis_name_checkbox:
            tour_bases = ron_api.read_tour_bases(host_id, tour_code, server_url)

            for tour_base in tour_bases:
                basis_name = tour_base['strBasisDesc']
                basis_id = tour_base['intBasisID']
                sub_basis_name = tour_base['strSubBasisDesc']
                sub_basis_id = tour_base['intSubBasisID']

                if host_ids_checkbox:
                    csv_host_id = str(host_id) + csv_separator
                else:
                    csv_host_id = ""
                if tour_names_checkbox:
                    csv_tour_name = str(tour_name).replace(',', '') + csv_separator
                else:
                    csv_tour_name = ""
                if tour_codes_checkbox:
                    csv_tour_code = str(tour_code) + csv_separator
                else:
                    csv_tour_code = ""
                if basis_name_checkbox:
                    csv_basis_name = str(basis_name).replace(',', '') + csv_separator
                else:
                    csv_basis_name = ""
                if basis_checkbox:
                    csv_basis_id = str(basis_id) + csv_separator
                else:
                    csv_basis_id = ""
                if sub_basis_name_checkbox:
                    csv_sub_basis_name = str(sub_basis_name).replace(',', '') + csv_separator
                else:
                    csv_sub_basis_name = ""
                if sub_basis_checkbox:
                    csv_sub_basis_id = str(sub_basis_id) + csv_separator
                else:
                    csv_sub_basis_id = ""

                csv_content += (
                                   csv_host_id + csv_tour_name + csv_tour_code + csv_basis_name + csv_basis_id + csv_sub_basis_name + csv_sub_basis_id).rstrip(
                    csv_separator) + "\n"

        elif host_ids_checkbox | tour_codes_checkbox | tour_names_checkbox:
            if host_ids_checkbox:
                csv_host_id = str(host_id) + csv_separator
            else:
                csv_host_id = ""
            if tour_names_checkbox:
                csv_tour_name = str(tour_name).replace(',', '') + csv_separator
            else:
                csv_tour_name = ""
            if tour_codes_checkbox:
                csv_tour_code = str(tour_code) + csv_separator
            else:
                csv_tour_code = ""

            csv_content += (csv_host_id + csv_tour_name + csv_tour_code).rstrip(csv_separator) + "\n"

    elif data_level == "3":
        tour_name = parameters.split(',')[1]
        tour_code = parameters.split(',')[2]
        basis_name = parameters.split(',')[3]
        basis_id = parameters.split(',')[4]
        sub_basis_name = parameters.split(',')[5]
        sub_basis_id = parameters.split(',')[6]

        if pickup_keys_checkbox:
            tour_times = ron_api.read_tour_times(host_id, tour_code, server_url)

            for tour_time in tour_times:
                time_id = tour_time['intTourTimeID']
                tour_pickups = ron_api.read_tour_pickups(host_id, tour_code, time_id, basis_id,
                                                         server_url)

                for tour_pickup in tour_pickups:
                    pickup_key = tour_pickup['strPickupKey']

                    if host_ids_checkbox:
                        csv_host_id = str(host_id) + csv_separator
                    else:
                        csv_host_id = ""
                    if tour_names_checkbox:
                        csv_tour_name = str(tour_name).replace(',', '') + csv_separator
                    else:
                        csv_tour_name = ""
                    if tour_codes_checkbox:
                        csv_tour_code = str(tour_code) + csv_separator
                    else:
                        csv_tour_code = ""
                    if basis_name_checkbox:
                        csv_basis_name = str(basis_name).replace(',', '') + csv_separator
                    else:
                        csv_basis_name = ""
                    if basis_checkbox:
                        csv_basis_id = str(basis_id) + csv_separator
                    else:
                        csv_basis_id = ""
                    if sub_basis_name_checkbox:
                        csv_sub_basis_name = str(sub_basis_name).replace(',', '') + csv_separator
                    else:
                        csv_sub_basis_name = ""
                    if sub_basis_checkbox:
                        csv_sub_basis_id = str(sub_basis_id) + csv_separator
                    else:
                        csv_sub_basis_id = ""
                    if time_ids_checkbox:
                        csv_time_id = str(time_id) + csv_separator
                    else:
                        csv_time_id = ""

                    csv_content += (csv_host_id + csv_tour_name + csv_tour_code + csv_basis_name + csv_basis_id +
                                    csv_sub_basis_name + csv_sub_basis_id + csv_time_id +
                                    str(pickup_key)).rstrip(csv_separator) + "\n"

        elif time_ids_checkbox:
            tour_times = ron_api.read_tour_times(host_id, tour_code, server_url)

            for tour_time in tour_times:
                time_id = tour_time['intTourTimeID']

                if host_ids_checkbox:
                    csv_host_id = str(host_id) + csv_separator
                else:
                    csv_host_id = ""
                if tour_names_checkbox:
                    csv_tour_name = str(tour_name).replace(',', '') + csv_separator
                else:
                    csv_tour_name = ""
                if tour_codes_checkbox:
                    csv_tour_code = str(tour_code) + csv_separator
                else:
                    csv_tour_code = ""
                if basis_name_checkbox:
                    csv_basis_name = str(basis_name).replace(',', '') + csv_separator
                else:
                    csv_basis_name = ""
                if basis_checkbox:
                    csv_basis_id = str(basis_id) + csv_separator
                else:
                    csv_basis_id = ""
                if sub_basis_name_checkbox:
                    csv_sub_basis_name = str(sub_basis_name).replace(',', '') + csv_separator
                else:
                    csv_sub_basis_name = ""
                if sub_basis_checkbox:
                    csv_sub_basis_id = str(sub_basis_id) + csv_separator
                else:
                    csv_sub_basis_id = ""
                if time_ids_checkbox:
                    csv_time_id = str(time_id) + csv_separator
                else:
                    csv_time_id = ""

                csv_content += (csv_host_id + csv_tour_name + csv_tour_code + csv_basis_name + csv_basis_id +
                                csv_sub_basis_name + csv_sub_basis_id + csv_time_id).rstrip(csv_separator) + "\n"

        elif host_ids_checkbox | tour_names_checkbox | tour_codes_checkbox | basis_name_checkbox | basis_checkbox | \
                sub_basis_name_checkbox | sub_basis_checkbox:
            if host_ids_checkbox:
                csv_host_id = str(host_id) + csv_separator
            else:
                csv_host_id = ""
            if tour_names_checkbox:
                csv_tour_name = str(tour_name).replace(',', '') + csv_separator
            else:
                csv_tour_name = ""
            if tour_codes_checkbox:
                csv_tour_code = str(tour_code) + csv_separator
            else:
                csv_tour_code = ""
            if basis_name_checkbox:
                csv_basis_name = str(basis_name).replace(',', '') + csv_separator
            else:
                csv_basis_name = ""
            if basis_checkbox:
                csv_basis_id = str(basis_id) + csv_separator
            else:
                csv_basis_id = ""
            if sub_basis_name_checkbox:
                csv_sub_basis_name = str(sub_basis_name).replace(',', '') + csv_separator
            else:
                csv_sub_basis_name = ""
            if sub_basis_checkbox:
                csv_sub_basis_id = str(sub_basis_id) + csv_separator
            else:
                csv_sub_basis_id = ""

            csv_content += (csv_host_id + csv_tour_name + csv_tour_code + csv_basis_name + csv_basis_id +
                            csv_sub_basis_name + csv_sub_basis_id).rstrip(csv_separator) + "\n"

    elif data_level == "4":
        tour_name = parameters.split(',')[1]
        tour_code = parameters.split(',')[2]
        basis_name = parameters.split(',')[3]
        basis_id = parameters.split(',')[4]
        sub_basis_name = parameters.split(',')[5]
        sub_basis_id = parameters.split(',')[6]
        time_id = parameters.split(',')[7]

        if pickup_keys_checkbox:
            tour_pickups = ron_api.read_tour_pickups(host_id, tour_code, time_id, basis_id,
                                                     server_url)

            for tour_pickup in tour_pickups:
                pickup_key = tour_pickup['strPickupKey']

                if host_ids_checkbox:
                    csv_host_id = str(host_id) + csv_separator
                else:
                    csv_host_id = ""
                if tour_names_checkbox:
                    csv_tour_name = str(tour_name).replace(',', '') + csv_separator
                else:
                    csv_tour_name = ""
                if tour_codes_checkbox:
                    csv_tour_code = str(tour_code) + csv_separator
                else:
                    csv_tour_code = ""
                if basis_name_checkbox:
                    csv_basis_name = str(basis_name).replace(',', '') + csv_separator
                else:
                    csv_basis_name = ""
                if basis_checkbox:
                    csv_basis_id = str(basis_id) + csv_separator
                else:
                    csv_basis_id = ""
                if sub_basis_name_checkbox:
                    csv_sub_basis_name = str(sub_basis_name).replace(',', '') + csv_separator
                else:
                    csv_sub_basis_name = ""
                if sub_basis_checkbox:
                    csv_sub_basis_id = str(sub_basis_id) + csv_separator
                else:
                    csv_sub_basis_id = ""
                if time_ids_checkbox:
                    csv_time_id = str(time_id) + csv_separator
                else:
                    csv_time_id = ""

                csv_content += (csv_host_id + csv_tour_name + csv_tour_code + csv_basis_name + csv_basis_id +
                                csv_sub_basis_name + csv_sub_basis_id + csv_time_id +
                                str(pickup_key)).rstrip(csv_separator) + "\n"
        elif host_ids_checkbox | tour_names_checkbox | tour_codes_checkbox | basis_name_checkbox | basis_checkbox | \
                sub_basis_name_checkbox | sub_basis_checkbox | time_ids_checkbox:
            if host_ids_checkbox:
                csv_host_id = str(host_id) + csv_separator
            else:
                csv_host_id = ""
            if tour_names_checkbox:
                csv_tour_name = str(tour_name).replace(',', '') + csv_separator
            else:
                csv_tour_name = ""
            if tour_codes_checkbox:
                csv_tour_code = str(tour_code) + csv_separator
            else:
                csv_tour_code = ""
            if basis_name_checkbox:
                csv_basis_name = str(basis_name).replace(',', '') + csv_separator
            else:
                csv_basis_name = ""
            if basis_checkbox:
                csv_basis_id = str(basis_id) + csv_separator
            else:
                csv_basis_id = ""
            if sub_basis_name_checkbox:
                csv_sub_basis_name = str(sub_basis_name).replace(',', '') + csv_separator
            else:
                csv_sub_basis_name = ""
            if sub_basis_checkbox:
                csv_sub_basis_id = str(sub_basis_id) + csv_separator
            else:
                csv_sub_basis_id = ""
            if time_ids_checkbox:
                csv_time_id = str(time_id) + csv_separator
            else:
                csv_time_id = ""

            csv_content += (csv_host_id + csv_tour_name + csv_tour_code + csv_basis_name + csv_basis_id +
                            csv_sub_basis_name + csv_sub_basis_id + csv_time_id).rstrip(csv_separator) + "\n"

    elif data_level == "5":
        tour_name = parameters.split(',')[1]
        tour_code = parameters.split(',')[2]
        basis_name = parameters.split(',')[3]
        basis_id = parameters.split(',')[4]
        sub_basis_name = parameters.split(',')[5]
        sub_basis_id = parameters.split(',')[6]
        time_id = parameters.split(',')[7]
        pickup_key = parameters.split(',')[8]

        if host_ids_checkbox:
            csv_host_id = str(host_id) + csv_separator
        else:
            csv_host_id = ""
        if tour_names_checkbox:
            csv_tour_name = str(tour_name).replace(',', '') + csv_separator
        else:
            csv_tour_name = ""
        if tour_codes_checkbox:
            csv_tour_code = str(tour_code) + csv_separator
        else:
            csv_tour_code = ""
        if basis_name_checkbox:
            csv_basis_name = str(basis_name).replace(',', '') + csv_separator
        else:
            csv_basis_name = ""
        if basis_checkbox:
            csv_basis_id = str(basis_id) + csv_separator
        else:
            csv_basis_id = ""
        if sub_basis_name_checkbox:
            csv_sub_basis_name = str(sub_basis_name).replace(',', '') + csv_separator
        else:
            csv_sub_basis_name = ""
        if sub_basis_checkbox:
            csv_sub_basis_id = str(sub_basis_id) + csv_separator
        else:
            csv_sub_basis_id = ""
        if time_ids_checkbox:
            csv_time_id = str(time_id) + csv_separator
        else:
            csv_time_id = ""
        if pickup_keys_checkbox:
            csv_pickup_key = str(pickup_key)
        else:
            csv_pickup_key = ""

        csv_content += (csv_host_id + csv_tour_name + csv_tour_code + csv_basis_name + csv_basis_id +
                        csv_sub_basis_name + csv_sub_basis_id + csv_time_id +
                        csv_pickup_key).rstrip(csv_separator) + "\n"

    response_data = {
        'csv_content': csv_content,
    }

    return JsonResponse(response_data)