from authentication.models import Province, City, CityUnit, SystemAddress, SystemUserProfile, BankCard
from panel.models import Poultry, PoultryHatching, CityOperator, PoultryRequest, KillHouseOperator, \
    KillHouseAllowVet, KillHousePercentage, KillHouseDriver, CityOperatorCheckRequest, KillHouseADDCAR, \
    ProvinceOperator, ProvinceCheckOperatorOutRequest, ProvinceCheckOperatorRequest, ShareOfAllocation, KillRequest, \
    KillRequestFactor, KillRequestFactorPayment, ProvinceKillRequest, KillHouseRequest, KillHouseCheckRequest, \
    KillHouseAssignmentInformation, ProvinceCheckInformation, ProvinceFactorToKillHouse, KillHouseFactorToProvince, \
    ProvinceCheckKillHouseFactor, DepositAllocation, InspectorOperator, PovinceInspector, Vet, KillHouseVet, \
    VetCheckRequest, VetFarm, VetFarmInspection, Admin, Jahad, CityJahad, ProvincialGovernment, VetSupervisor, \
    ProvinceAllowKillHouseRegisterCar, ProvinceAllowPoultryChooseKillHouse, ProvinceAllowPoultrySellFree, \
    KillHouseDailyQuota, ProvinceAutoAllocation, Pricing, PoultryAllowCityProvince, TotalPoultryRequestQuantity, \
    VetCheckAllocations, Wallet


def make_temp_keys():
    from panel.models import KillHouse
    wallets = Wallet.objects.all()
    provinces = Province.objects.all()
    cities = City.objects.all()
    cityunits = CityUnit.objects.all()
    system_addresses = SystemAddress.objects.all()
    bank_cards = BankCard.objects.all()
    system_userprofiles = SystemUserProfile.objects.all()
    pricings = Pricing.objects.all()
    poultries = Poultry.objects.all()
    poultry_allow_citys_provinces = PoultryAllowCityProvince.objects.all()
    hatchings = PoultryHatching.objects.all()
    city_operators = CityOperator.objects.all()
    poultry_requests = PoultryRequest.objects.all()
    totals_poultry_request_quantity = TotalPoultryRequestQuantity.objects.all()
    kill_house_operators = KillHouseOperator.objects.all()
    KillHouses = KillHouse.objects.all()
    killhouseallowvets = KillHouseAllowVet.objects.all()
    killhousepercentages = KillHousePercentage.objects.all()
    drivers = KillHouseDriver.objects.all()
    add_cars = KillHouseADDCAR.objects.all()
    city_check_requests = CityOperatorCheckRequest.objects.all()
    province_operators = ProvinceOperator.objects.all()
    province_check_out_requests = ProvinceCheckOperatorOutRequest.objects.all()
    province_check_requests = ProvinceCheckOperatorRequest.objects.all()
    share_of_allocations = ShareOfAllocation.objects.all()
    kill_requests = KillRequest.objects.all()
    kill_request_factors = KillRequestFactor.objects.all()
    kill_request_payment_factors = KillRequestFactorPayment.objects.all()
    province_kill_requests = ProvinceKillRequest.objects.all()
    kill_house_requests = KillHouseRequest.objects.all()
    kill_house_check_requests = KillHouseCheckRequest.objects.all()
    assignment_informations = KillHouseAssignmentInformation.objects.all()
    province_check_informations = ProvinceCheckInformation.objects.all()
    province_factors = ProvinceFactorToKillHouse.objects.all()
    kill_house_factors = KillHouseFactorToProvince.objects.all()
    province_check_kill_house_factors = ProvinceCheckKillHouseFactor.objects.all()
    deposit_allocations = DepositAllocation.objects.all()
    inspectors = InspectorOperator.objects.all()
    inspector_checks = PovinceInspector.objects.all()
    vets = Vet.objects.all()
    kill_house_vets = KillHouseVet.objects.all()
    vet_check_requests = VetCheckRequest.objects.all()
    vet_farms = VetFarm.objects.all()
    vet_farm_inspections = VetFarmInspection.objects.all()
    admins = Admin.objects.all()
    jahads = Jahad.objects.all()
    city_jahads = CityJahad.objects.all()
    goverments = ProvincialGovernment.objects.all()
    vet_supervisers = VetSupervisor.objects.all()
    vet_check_allocations = VetCheckAllocations.objects.all()
    province_allow_kill_house_registers = ProvinceAllowKillHouseRegisterCar.objects.all()
    province_allow_poultry_choose_kill_houses = ProvinceAllowPoultryChooseKillHouse.objects.all()
    province_allow_poultry_auto_sell = ProvinceAllowPoultrySellFree.objects.all()
    kill_house_daily_quotas = KillHouseDailyQuota.objects.all()
    province_auto_allocations = ProvinceAutoAllocation.objects.all()

    for wallet in wallets:
        wallet.province_name = 'لرستان'
        wallet.save()

    for bank_card in bank_cards:
        bank_card.user_bank_id_key = bank_card.id
        bank_card.province_name = 'لرستان'
        bank_card.save()


    # for province in provinces:
    #     province.province_id_key = province.id
    #     province.save()
    #
    # for city in cities:
    #     city.province_id_foreign_key = city.province.id
    #     city.city_id_key = city.id
    #     city.save()
    #
    # for cityunit in cityunits:
    #     cityunit.city_id_foreign_key = cityunit.city.id
    #     cityunit.city_unit_id_key = cityunit.id
    #     cityunit.save()
    #
    # for system_addresse in system_addresses:
    #     system_addresse.province_id_foreign_key = system_addresse.province.id
    #     system_addresse.city_id_foreign_key = system_addresse.city.id
    #     system_addresse.address_id_key = system_addresse.id
    #     system_addresse.save()
    #
    #
    # for system_userprofile in system_userprofiles:
    #     system_userprofile.city_id_foreign_key = system_userprofile.city.id
    #     system_userprofile.province_id_foreign_key = system_userprofile.province.id
    #     system_userprofile.user_django_id_foreign_key = system_userprofile.user.id
    #     system_userprofile.system_user_profile_id_key = system_userprofile.id
    #     system_userprofile.save()
    #
    # for pricing in pricings:
    #     if pricing.operator != None:
    #         pricing.operator_id_foreign_key = pricing.operator.id
    #     pricing.pricing_id_key = pricing.id
    #     pricing.save()
    #
    # for poultry in poultries:
    #     if poultry.owner != None:
    #         poultry.owner_id_foreign_key = poultry.owner.id
    #     poultry.user_id_foreign_key = poultry.user.id
    #     poultry.address_id_foreign_key = poultry.address.id
    #     if poultry.user_bank_info != None:
    #         poultry.user_bank_id_foreign_key = poultry.user_bank_info.id
    #     poultry.wallet_id_foreign_key = poultry.wallet.id
    #     poultry.poultry_id_key = poultry.id
    #     poultry.save()
    #
    # for poultry_allow_city_province in poultry_allow_citys_provinces:
    #     poultry_allow_city_province.poultry_id_foreign_key = poultry_allow_city_province.poultry.id
    #     poultry_allow_city_province.poultry_allow_city_province_id_key = poultry_allow_city_province.id
    #     poultry_allow_city_province.save()
    #
    # for hatching in hatchings:
    #     hatching.poultry_id_foreign_key = hatching.poultry.id
    #     hatching.poultry_hatching_id_key = hatching.id
    #     hatching.save()
    #
    # for city_operator in city_operators:
    #     city_operator.user_id_foreign_key = city_operator.user.id
    #     city_operator.address_id_foreign_key = city_operator.address.id
    #     if city_operator.user_bank_info != None:
    #         city_operator.user_bank_id_foreign_key = city_operator.user_bank_info.id
    #     city_operator.wallet_id_foreign_key = city_operator.wallet.id
    #     city_operator.city_operator_id_key = city_operator.id
    #     city_operator.save()
    #
    # for poultry_request in poultry_requests:
    #     poultry_request.city_operator_id_foreign_key = poultry_request.city_operator.id
    #     poultry_request.poultry_id_foreign_key = poultry_request.poultry.id
    #     poultry_request.poultry_hatching_id_foreign_key = poultry_request.hatching.id
    #     poultry_request.poultry_request_id_key = poultry_request.id
    #     poultry_request.save()
    #
    # for total_poultry_request_quantity in totals_poultry_request_quantity:
    #     total_poultry_request_quantity.total_poultry_request_quantity_id_key = total_poultry_request_quantity.id
    #     total_poultry_request_quantity.save()
    #
    # for kill_house_operator in kill_house_operators:
    #     kill_house_operator.user_id_foreign_key = kill_house_operator.user.id
    #     kill_house_operator.address_id_foreign_key = kill_house_operator.address.id
    #     if kill_house_operator.user_bank_info != None:
    #         kill_house_operator.user_bank_id_foreign_key = kill_house_operator.user_bank_info.id
    #     kill_house_operator.wallet_id_foreign_key = kill_house_operator.wallet.id
    #     kill_house_operator.kill_house_operator_id_key = kill_house_operator.id
    #     kill_house_operator.save()
    #
    # for KillHouse in KillHouses:
    #     KillHouse.kill_house_operator_id_foreign_key = KillHouse.kill_house_operator.id
    #     KillHouse.system_address_id_foreign_key = KillHouse.system_address.id
    #     KillHouse.kill_house_id_key = KillHouse.id
    #     KillHouse.save()
    #
    # for killhouseallowvet in killhouseallowvets:
    #     killhouseallowvet.kill_house_id_foreign_key = killhouseallowvet.kill_house.id
    #     killhouseallowvet.kill_house_allow_vet_id_key = killhouseallowvet.id
    #     killhouseallowvet.save()
    #
    # for killhousepercentage in killhousepercentages:
    #     killhousepercentage.kill_house_id_foreign_key = killhousepercentage.kill_house.id
    #     if killhousepercentage.kill_house_for_killer != None:
    #         killhousepercentage.kill_house_for_killer_id_foreign_key = killhousepercentage.kill_house_for_killer.id
    #     killhousepercentage.kill_house_percentage_id_key = killhousepercentage.id
    #     killhousepercentage.save()
    #
    # for driver in drivers:
    #     driver.user_id_foreign_key = driver.user.id
    #     if driver.user_bank_info != None:
    #         driver.user_bank_id_foreign_key = driver.user_bank_info.id
    #     driver.wallet_id_foreign_key = driver.wallet.id
    #     driver.kill_house_driver_id_key = driver.id
    #     driver.save()
    #
    # for add_car in add_cars:
    #     add_car.kill_house_id_foreign_key = add_car.kill_house.id
    #     add_car.driver_id_foreign_key = add_car.driver.id
    #     add_car.kill_house_add_car_id_key = add_car.id
    #     add_car.save()
    #
    # for city_check_request in city_check_requests:
    #     city_check_request.city_operator_system_id_foreign_key = city_check_request.city_operator_system.id
    #     city_check_request.poultry_request_id_foreign_key = city_check_request.poultry_request.id
    #     city_check_request.city_operator_check_request_id_key = city_check_request.id
    #     city_check_request.save()
    #
    # for province_operator in province_operators:
    #     province_operator.user_id_foreign_key = province_operator.user.id
    #     province_operator.address_id_foreign_key = province_operator.address.id
    #     if province_operator.user_bank_info != None:
    #         province_operator.user_bank_id_foreign_key = province_operator.user_bank_info.id
    #     province_operator.wallet_id_foreign_key = province_operator.wallet.id
    #     province_operator.province_operator_id_key = province_operator.id
    #     province_operator.save()
    #
    # for province_check_out_request in province_check_out_requests:
    #     province_check_out_request.province_operator_system_id_foreign_key = province_check_out_request.province_operator_system.id
    #     province_check_out_request.poultry_request_id_foreign_key = province_check_out_request.poultry_request.id
    #     province_check_out_request.province_operator_check_out_request_id_key = province_check_out_request.id
    #     province_check_out_request.save()
    #
    # for province_check_request in province_check_requests:
    #     province_check_request.province_operator_system_id_foreign_key = province_check_request.province_operator_system.id
    #     province_check_request.poultry_request_id_foreign_key = province_check_request.poultry_request.id
    #     province_check_request.city_request_poultry_id_foreign_key = province_check_request.city_request_Poultry.id
    #     province_check_request.province_operator_check_request_id_key = province_check_request.id
    #     province_check_request.save()
    #
    # for share_of_allocation in share_of_allocations:
    #     share_of_allocation.province_id_foreign_key = share_of_allocation.province.id
    #     share_of_allocation.share_of_allocation_id_key = share_of_allocation.id
    #     share_of_allocation.save()
    #
    # for kill_request in kill_requests:
    #     kill_request.kill_house_id_foreign_key = kill_request.kill_house.id
    #     if kill_request.slaughter_house != None:
    #         kill_request.slaughter_house_id_foreign_key = kill_request.slaughter_house.id
    #     kill_request.kill_request_id_key = kill_request.id
    #     kill_request.save()
    #
    # for kill_request_factor in kill_request_factors:
    #     kill_request_factor.kill_request_id_foreign_key = kill_request_factor.kill_request.id
    #     kill_request_factor.kill_request_factor_id_key = kill_request_factor.id
    #     kill_request_factor.save()
    #
    # for kill_request_payment_factor in kill_request_payment_factors:
    #     kill_request_payment_factor.kill_request_factor_id_foreign_key = kill_request_payment_factor.kill_request_factor.id
    #     kill_request_payment_factor.kill_request_factor_payment_id_key = kill_request_payment_factor.id
    #     kill_request_payment_factor.save()
    #
    # for province_kill_request in province_kill_requests:
    #     province_kill_request.killhouse_user_id_foreign_key = province_kill_request.killhouse_user.id
    #     province_kill_request.kill_request_id_foreign_key = province_kill_request.kill_request.id
    #     province_kill_request.province_request_id_foreign_key = province_kill_request.province_request.id
    #     province_kill_request.province_kill_request_id_key = province_kill_request.id
    #     province_kill_request.save()
    #
    # for kill_house_request in kill_house_requests:
    #     kill_house_request.killhouse_user_id_foreign_key = kill_house_request.killhouse_user.id
    #     kill_house_request.kill_request_id_foreign_key = kill_house_request.kill_request.id
    #     kill_house_request.province_request_id_foreign_key = kill_house_request.province_request.id
    #     kill_house_request.province_kill_request_id_foreign_key = kill_house_request.province_kill_request.id
    #     kill_house_request.add_car_id_foreign_key = kill_house_request.add_car.id
    #     kill_house_request.kill_house_request_id_key = kill_house_request.id
    #     kill_house_request.save()
    #
    # for kill_house_check_request in kill_house_check_requests:
    #     kill_house_check_request.province_kill_request_id_foreign_key = kill_house_check_request.province_kill_request.id
    #     kill_house_check_request.kill_house_check_request_id_key = kill_house_check_request.id
    #     kill_house_check_request.save()
    #
    # for assignment_information in assignment_informations:
    #     assignment_information.kill_house_check_id_foreign_key = assignment_information.kill_house_check.id
    #     assignment_information.kill_house_request_id_foreign_key = assignment_information.kill_house_request.id
    #     assignment_information.kill_house_kill_house_assingment_information_id_key = assignment_information.id
    #     assignment_information.save()
    #
    # for province_check_information in province_check_informations:
    #     province_check_information.kill_house_assignment_id_foreign_key = province_check_information.kill_house_assignment.id
    #     if province_check_information.province_operator != None:
    #         province_check_information.province_operator_id_foreign_key = province_check_information.province_operator.id
    #     province_check_information.province_check_information_id_key = province_check_information.id
    #     province_check_information.save()
    #
    # for province_factor in province_factors:
    #     province_factor.province_check_info_id_foreign_key = province_factor.province_check_info.id
    #     province_factor.province_check_req_id_foreign_key = province_factor.province_check_req.id
    #     province_factor.user_bank_id_foreign_key = province_factor.bank.id
    #     province_factor.province_factor_to_kill_house_id_key = province_factor.id
    #     province_factor.save()
    #
    # for kill_house_factor in kill_house_factors:
    #     kill_house_factor.province_factor_id_foreign_key = kill_house_factor.province_factor.id
    #     kill_house_factor.kill_house_factor_to_province_id_key = kill_house_factor.id
    #     kill_house_factor.save()
    #
    # for province_check_kill_house_factor in province_check_kill_house_factors:
    #     province_check_kill_house_factor.kill_house_factor_id_foreign_key = province_check_kill_house_factor.kill_house_factor.id
    #     province_check_kill_house_factor.province_check_kill_house_factor_id_key = province_check_kill_house_factor.id
    #     province_check_kill_house_factor.save()
    #
    # for deposit_allocation in deposit_allocations:
    #     deposit_allocation.poultry_request_id_foreign_key = deposit_allocation.poultry.id
    #     deposit_allocation.deposit_allocation_id_key = deposit_allocation.id
    #     deposit_allocation.save()
    #
    # for inspector in inspectors:
    #     inspector.user_id_foreign_key = inspector.user.id
    #     inspector.address_id_foreign_key = inspector.address.id
    #     if inspector.user_bank_info != None:
    #         inspector.user_bank_id_foreign_key = inspector.user_bank_info.id
    #     inspector.wallet_id_foreign_key = inspector.wallet.id
    #     inspector.inspector_operator_id_key = inspector.id
    #     inspector.save()
    #
    # for inspector_check in inspector_checks:
    #     inspector_check.inspector_operator_id_foreign_key = inspector_check.inspector_operator.id
    #     inspector_check.poultry_request_id_foreign_key = inspector_check.poultry_request.id
    #     inspector_check.province_inspector_id_key = inspector_check.id
    #     inspector_check.save()
    #
    # for vet in vets:
    #     vet.user_id_foreign_key = vet.user.id
    #     vet.address_id_foreign_key = vet.address.id
    #     if vet.user_bank_info != None:
    #         vet.user_bank_id_foreign_key = vet.user_bank_info.id
    #     vet.wallet_id_foreign_key = vet.wallet.id
    #     vet.vet_id_key = vet.id
    #     vet.save()
    #
    # for kill_house_vet in kill_house_vets:
    #     kill_house_vet.vet_id_foreign_key = kill_house_vet.vet.id
    #     kill_house_vet.kill_house_id_foreign_key = kill_house_vet.kill_house.id
    #     kill_house_vet.kill_house_vet_id_key = kill_house_vet.id
    #     kill_house_vet.save()
    #
    # for vet_check_request in vet_check_requests:
    #     vet_check_request.kill_house_vet_id_foreign_key = vet_check_request.kill_house_vet.id
    #     vet_check_request.kill_house_request_id_foreign_key = vet_check_request.kill_house_request.id
    #     vet_check_request.vet_check_request_id_key = vet_check_request.id
    #     vet_check_request.save()
    #
    # for vet_farm in vet_farms:
    #     vet_farm.vet_id_foreign_key = vet_farm.vet.id
    #     vet_farm.poultry_id_foreign_key = vet_farm.poultry.id
    #     vet_farm.vet_farm_id_key = vet_farm.id
    #     vet_farm.save()
    #
    # for vet_farm_inspection in vet_farm_inspections:
    #     vet_farm_inspection.vet_farm_id_foreign_key = vet_farm_inspection.vet_farm.id
    #     vet_farm_inspection.poultry_hatching_id_foreign_key = vet_farm_inspection.poultry_hatching.id
    #     vet_farm_inspection.vet_farm_inspection_id_key = vet_farm_inspection.id
    #     vet_farm_inspection.save()
    #
    # for admin in admins:
    #     admin.user_id_foreign_key = admin.user.id
    #     admin.address_id_foreign_key = admin.address.id
    #     admin.admin_id_key = admin.id
    #     admin.save()
    #
    # for jahad in jahads:
    #     jahad.user_id_foreign_key = jahad.user.id
    #     if jahad.user_bank_info != None:
    #         jahad.user_bank_id_foreign_key = jahad.user_bank_info.id
    #     jahad.address_id_foreign_key = jahad.address.id
    #     jahad.wallet_id_foreign_key = jahad.wallet.id
    #     jahad.jahad_id_key = jahad.id
    #     jahad.save()
    #
    # for city_jahad in city_jahads:
    #     city_jahad.user_id_foreign_key = city_jahad.user.id
    #     city_jahad.address_id_foreign_key = city_jahad.address.id
    #     if city_jahad.user_bank_info != None:
    #         city_jahad.user_bank_id_foreign_key = city_jahad.user_bank_info.id
    #     city_jahad.wallet_id_foreign_key = city_jahad.wallet.id
    #     city_jahad.city_jahad_id_key = city_jahad.id
    #     city_jahad.save()
    #
    # for goverment in goverments:
    #     goverment.user_id_foreign_key = goverment.user.id
    #     goverment.address_id_foreign_key = goverment.address.id
    #     if goverment.user_bank_info != None:
    #         goverment.user_bank_id_foreign_key = goverment.user_bank_info.id
    #     goverment.wallet_id_foreign_key = goverment.wallet.id
    #     goverment.provincial_government_id_key = goverment.id
    #     goverment.save()
    #
    # for vet_superviser in vet_supervisers:
    #     vet_superviser.user_id_foreign_key = vet_superviser.user.id
    #     vet_superviser.address_id_foreign_key = vet_superviser.address.id
    #     if vet_superviser.user_bank_info != None:
    #         vet_superviser.user_bank_id_foreign_key = vet_superviser.user_bank_info.id
    #     vet_superviser.wallet_id_foreign_key = vet_superviser.wallet.id
    #     if vet_superviser.vet != None:
    #         vet_superviser.vet_id_foreign_key = vet_superviser.vet.id
    #     vet_superviser.vet_superviser_id_key = vet_superviser.id
    #     vet_superviser.save()
    #
    # for vet_check_allocation in vet_check_allocations:
    #     vet_check_allocation.vet_id_foreign_key = vet_check_allocation.vet.id
    #     vet_check_allocation.kill_house_request_id_foreign_key = vet_check_allocation.kill_house_request.id
    #     vet_check_allocation.vet_chick_allocations_id_key = vet_check_allocation.id
    #     vet_check_allocation.save()
    #
    # for province_allow_kill_house_register in province_allow_kill_house_registers:
    #     province_allow_kill_house_register.kill_house_id_foreign_key = province_allow_kill_house_register.kill_house.id
    #     province_allow_kill_house_register.province_allow_kill_house_register_car_id_key = province_allow_kill_house_register.id
    #     province_allow_kill_house_register.save()
    #
    # for province_allow_poultry_choose_kill_house in province_allow_poultry_choose_kill_houses:
    #     province_allow_poultry_choose_kill_house.poultry_id_foreign_key = province_allow_poultry_choose_kill_house.poultry.id
    #     province_allow_poultry_choose_kill_house.province_allow_poultry_choose_kill_house_id_key = province_allow_poultry_choose_kill_house.id
    #     province_allow_poultry_choose_kill_house.save()
    #
    # for province_allow_poultry_auto in province_allow_poultry_auto_sell:
    #     province_allow_poultry_auto.poultry_id_foreign_key = province_allow_poultry_auto.poultry.id
    #     province_allow_poultry_auto.province_allow_poultry_sell_free_id_key = province_allow_poultry_auto.id
    #     province_allow_poultry_auto.save()
    #
    # for kill_house_daily_quota in kill_house_daily_quotas:
    #     kill_house_daily_quota.kill_house_id_foreign_key = kill_house_daily_quota.kill_house.id
    #     if kill_house_daily_quota.killer_kill_house != None:
    #         kill_house_daily_quota.killer_kill_house_id_foreign_key = kill_house_daily_quota.killer_kill_house.id
    #     kill_house_daily_quota.kill_request_id_foreign_key = kill_house_daily_quota.kill_request.id
    #     kill_house_daily_quota.kill_house_daily_quota_id_key = kill_house_daily_quota.id
    #     kill_house_daily_quota.save()
    #
    # for province_auto_allocation in province_auto_allocations:
    #     province_auto_allocation.daily_quota_id_foreign_key = province_auto_allocation.daily_quota.id
    #     province_auto_allocation.poultry_request_id_foreign_key = province_auto_allocation.poultry_request.id
    #     province_auto_allocation.province_kill_request_id_foreign_key = province_auto_allocation.province_kill_request.id
    #     province_auto_allocation.province_auto_allocation_id_key = province_auto_allocation.id
    #     province_auto_allocation.save()
