Skip to content

Commit

Permalink
Ajout migration de données labels de financement
Browse files Browse the repository at this point in the history
  • Loading branch information
ggounot committed Nov 12, 2024
1 parent c1a94a3 commit 66a9b5a
Showing 1 changed file with 334 additions and 0 deletions.
334 changes: 334 additions & 0 deletions back/dora/services/migrations/0112_add_funding_labels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,334 @@
# Generated by Django 4.2.16 on 2024-11-04 16:43

from django.db import migrations

FUNDED_SERVICE_SLUGS_AVEYRON = [
"ass-pour-droit-a-l-i-dwdv-microcredit-mobilite-lhjo",
"ass-pour-droit-a-l-i-dwdv-microcredit-mobilite-mlhr",
"ass-pour-droit-a-l-i-dwdv-microcredit-mobilite",
"ass-pour-droit-a-l-i-dwdv-",
"ass-pour-droit-a-l-i-dwdv--kivw",
"ass-pour-droit-a-l-i-dwdv-microcredit-professi-vdlf",
"ass-pour-droit-a-l-i-dwdv-microcredit-professi-dgnl",
"ass-pour-droit-a-l-i-dwdv-microcredit-professi-jkaf",
"ass-pour-droit-a-l-i-dwdv-microcredit-professi",
"association-myriade-information-et-accom",
"association-myriade-apprendre-le-francai",
"comite-rouergat-daid-francais-langue-etra-ivkb",
"comite-rouergat-daid-francais-langue-etra-zmxk",
"comite-rouergat-daid-alphabetisation-lutt-mjwn",
"comite-rouergat-daid-alphabetisation-lutt",
"comite-rouergat-daid-francais-langue-etra",
"comite-rouergat-daid-alphabetisation-lutt-sgcx",
"comite-rouergat-daid-alphabetisation-lutt-sgcx",
"comite-rouergat-daid-francais-langue-etra-yssh",
"comite-rouergat-daid-francais-langue-etra-jsru",
"centre-dinformation--tojo-information-et-accom",
"vacances-familles-v--vacances-pour-tous",
"village-12-ateliers-de-francais",
"village-12-accompagnement-socia",
"village-12-mobilite-des-demande",
"acces-logement-inser-centre-dhebergement--hmvm",
]

FUNDED_SERVICE_SLUGS_DROME = [
"agir-innover-mobilis-on-a-des-projets",
"agir-innover-mobilis-et-si-on-relevait-le-pfaj",
"agir-innover-mobilis-et-si-on-relevait-le-kwyq",
"agir-innover-mobilis-et-si-on-relevait-le-andd",
"agir-innover-mobilis-et-si-on-relevait-le-gjsi",
"agir-innover-mobilis-identification-des-m",
"agir-innover-mobilis-identification-des-m-mulq",
"agir-innover-mobilis-identification-des-m-wktt",
"agir-innover-mobilis-identification-des-m-plbm",
"agir-innover-mobilis-identification-des-m-wxsn",
"ancre-et-si-on-decouvrait--ycqw",
"ancre-et-si-on-decouvrait--gcmr",
"ancre-et-si-on-decouvrait--zvmy",
"ancre-et-si-on-decouvrait--otlp",
"ancre-et-si-on-decouvrait--zglv",
"archer-levee-des-freins-jin-seis",
"archer-levee-des-freins-jin-wiia",
"archer-levee-des-freins-jin-ltab",
"archer-levee-des-freins-jin-nogy",
"archer-levee-des-freins-jin-fhmn",
"archer-levee-des-freins-jin-veqv",
"archer-jinterroge-mon-activ",
"archer-levee-des-freins-jin-cnjs",
"bimbamjob-jlgu-vers-un-nouveau-depa",
"bimbamjob-jlgu-vers-un-nouveau-depa-vyea",
"bimbamjob-jlgu-vers-un-nouveau-depa-ulya",
"bimbamjob-jlgu-job-coaching-26",
"cefora-sarl-cefora-vers-un-nouveau-depa",
"cefora-sarl-cefora-vers-un-nouveau-depa-jope",
"plateforme-dinsertio-et-si-on-decouvrait-",
"plateforme-dinsertio-vers-lemploi",
"plateforme-dinsertio-le-permis-de-conduir",
"plateforme-dinsertio-preparation-et-accom-usqu",
"germinal-07-jinterroge-mon-activ",
"germinal-07-jinterroge-mon-activ-ohwe",
"germinal-07-jinterroge-mon-activ-jvaz",
"germinal-07-jinterroge-mon-activ-tasr",
"germinal-07-jinterroge-mon-activ-bmht",
"innovation-developpe-akuu-levee-des-freins-san-lbnw",
"innovation-developpe-akuu-levee-des-freins-san",
"innovation-developpe-akuu-levee-des-freins-san-eoen",
"innovation-developpe-akuu-sante-et-employabili",
"institut-national-de-eyjf-vers-un-nouveau-depa-mcri",
"institut-national-de-eyjf-vers-un-nouveau-depa-vcqc",
"institut-national-de-eyjf-vers-un-nouveau-depa-pnye",
"institut-national-de-eyjf-vers-un-nouveau-depa-dfqc",
"institut-national-de-eyjf-vers-un-nouveau-depa-mbng",
"institut-national-de-eyjf-le-permis-de-conduir",
"institut-national-de-eyjf-le-permis-de-conduir-qbki",
"institut-national-de-eyjf-le-permis-de-conduir-scyr",
"institut-national-de-eyjf-le-permis-de-conduir-fjre",
"institut-national-de-eyjf-le-permis-de-conduir-qrra",
"institut-promotions--identification-des-m-eyqd",
"institut-promotions--identification-des-m-ckis",
"institut-promotions--identification-des-m-wkpq",
"institut-promotions--identification-des-m-ftlr",
"institut-promotions--identification-des-m-qfod",
"institut-promotions--identification-des-m-qsvi",
"institut-promotions--identification-des-m-xjxo",
"institut-promotions--et-si-on-relevait-le-xusy",
"institut-promotions--et-si-on-relevait-le-ejsu",
"institut-promotions--et-si-on-relevait-le-vsve",
"institut-promotions--et-si-on-relevait-le-giyz",
"institut-promotions--et-si-on-relevait-le-tsne",
"institut-promotions--et-si-on-relevait-le-fpzu",
"institut-promotions--et-si-on-relevait-le-jijd",
"institut-promotions--levee-des-freins-san-bwps",
"institut-promotions--levee-des-freins-san-nrpg",
"institut-promotions--levee-des-freins-san-gsfl",
"institut-promotions--levee-des-freins-san-iprt",
"institut-promotions--levee-des-freins-san-ntgz",
"institut-promotions--levee-des-freins-san-diya",
"mobilite-07-26-permis-de-conduire-c-nrfs",
"mobilite-07-26-permis-de-conduire-c-sfja",
"mobilite-07-26-auto-ecole-insertion-pxjt",
"mobilite-07-26-lacces-a-des-vehicul-smkc",
"mobilite-07-26-lacces-a-des-vehicul",
"mobilite-07-26-lacces-a-des-vehicul-tfmg",
"mobilite-07-26-lacces-a-des-vehicul-kbds",
"mobilite-07-26-lacces-a-des-vehicul-qaqa",
"mobilite-07-26-lacces-a-des-vehicul-upjy",
"solerys-vers-un-nouveau-depa-qqif",
"solerys-vers-un-nouveau-depa",
"ass-tremplin-inserti-permis-de-conduire-c-bjzn",
"ass-tremplin-inserti-permis-de-conduire-c-imsn",
"ass-tremplin-inserti-permis-de-conduire-c-uoro",
"ass-tremplin-inserti-permis-de-conduire-a-wllm",
"valence-services-et-si-on-decouvrait-",
"valence-services-rsa-drome-accesentre-cmig",
"valence-services-rsa-drome-accesentre-jbxc",
"valence-services-rsa-drome-accesentre-xdyy",
"valence-services-rsa-drome-accesentre-tall",
"valence-services-rsa-drome-accesentre-rwib",
"valence-services-rsa-drome-accesentre-mwxr",
"valence-services-rsa-drome-accesentre-ikeb",
"valence-services-rsa-drome-accesentre-eiba",
"valence-services-rsa-drome-accesentre-dfso",
"valence-services-rsa-drome-accesentre-dcab",
"valence-services-rsa-arche-agglo-loca-zcpl",
"valence-services-rsa-arche-agglo-loca-rovo",
"valence-services-rsa-arche-agglo-loca-njtl",
"valence-services-rsa-arche-agglo-loca",
"valence-services-rsa-drome-accesentre-adlk",
"valence-services-rsa-drome-accesentre-ojtn",
"valence-services-rsa-porte-de-dromard-upbw",
"valence-services-rsa-porte-de-dromard-kiqh",
"valence-services-rsa-porte-de-dromard-ihlb",
"valence-services-rsa-porte-de-dromard",
"valence-services-rsa-drome-accesentre-xxir",
"valence-services-rsa-drome-accesentre-ombo",
"valence-services-rsa-drome-accesentre-mmql",
"valence-services-rsa-drome-accesentre-lrzt",
"valence-services-rsa-drome-accesentre-htsl",
"valence-services-rsa-drome-accesentre-ebhy",
"valence-services-rsa-drome-accesentre-atpu",
"valence-services-rsa-drome-accesentre",
"aequitaz-collectif-mixte-lutt",
"alter-egal-egal-emploi",
"association-sociale--fdpb-asnit",
"agence-developpement-formation-diplomante",
"centre-communal-dact-alsi-hebergement-durgence",
"centre-communal-dact-alsi-accueil-de-jour-sdf",
"chambre-d-agricultur-rebondir-26-xvat",
"chambre-d-agricultur-rebondir-26-xbzm",
"chambre-d-agricultur-rebondir-26-vmfh",
"chambre-d-agricultur-rebondir-26-rqat",
"chambre-d-agricultur-rebondir-26",
"diaconat-protestant-fpnt-agir-26",
"diaconat-protestant-fpnt-agir-26-iyrg",
"diaconat-protestant-mbld-rsa",
"diaconat-protestant-gkvo-cuisine-portage-de-r",
"dromolib-formation-ecoconduit",
"dromolib-remise-en-selle",
"dromolib-a-bicyclette-un-parc",
"dromolib-mad-velo",
"dromolib-atelier-reparation-v",
"dromolib-plans-de-deplacement",
"dromolib-point-info-mobilite",
"humando-ett-i",
"initiactive-2607-ied-cest-quoi-lentrepren",
"initiactive-2607-ied-marie-noelle-descham",
"initiactive-2607-ied-atelier-strategie-co",
"initiactive-2607-ied-permanence",
"initiactive-2607-ied-creation-dactivite-e",
"initiactive-2607-ied-atelier-financer-son",
"initiactive-2607-ied-atelier-financer-son-uczp",
"initiactive-2607-ied-atelier-gerer-son-ac",
"initiactive-2607-ied-atelier-gerer-son-ac-qacw",
"initiative-portes-de-diagnostic-projet-cr",
"initiative-portes-de-diagnostic-projet-cr-zoca",
"initiative-vallee-de-je-pilote-ma-boite",
"lintergroupe-marcel--formation-de-francai",
"lintergroupe-marcel--ateliers-vers-lemplo",
"la-plateforme-territ-atelier-decouverte-d-vkeo",
"la-plateforme-territ-atelier-savoir-lire-",
"la-plateforme-territ-atelier-mieux-connai",
"la-plateforme-territ-bilan-accompagnement",
"la-plateforme-territ-integracode",
"la-plateforme-territ-100-chances-100-empl",
"la-plateforme-territ-centre-ressources-il-bycd",
"la-plateforme-territ-les-clauses-sociales",
"la-plateforme-territ-bilan-accompagnement-jjaw",
"la-plateforme-territ-ecole-de-la-2e-chanc",
"la-plateforme-territ-comment-consolider-l",
"la-plateforme-territ-atelier-informatique",
"la-plateforme-territ-atelier-remobilisati",
"la-plateforme-territ-atelier-decouverte-p",
"lelien26-animation-sociale",
"lelien26-aide-administrative",
"lelien26-mediation-numerique",
"les-jardins-de-cocag-insertion-profession-ishi",
"les-jardins-de-cocag-vente-legumes-et-fru",
"les-jardins-de-cocag-insertion-profession",
"linstitut-des-vocati-live-linstitut-des-v",
"mission-locale-agglo-iod-intervention-sur",
"mission-locale-agglo-ote",
"mission-locale-agglo-contrat-engagement-j",
"mission-locale-agglo-pacea-parcours-contr",
"mission-locale-agglo-pacea-parcours-contr",
"mission-locale-agglo-atelier-mon-projet",
"mission-locale-agglo-formation-qtig",
"mission-locale-agglo-information-garde-de",
"mission-locale-de-la-lkja-immersion-en-entrepr",
"mission-locale-de-la-lkja-immersion-en-entrepr-ssrw",
"mission-locale-de-la-lkja-immersion-en-entrepr-suvg",
"mission-locale-de-la-lkja-immersion-en-entrepr-ggeo",
"mission-locale-de-la-lkja-contrat-dengagement-",
"mission-locale-de-la-lkja-contrat-dengagement--qepk",
"mission-locale-de-la-lkja-contrat-dengagement--agav",
"mission-locale-de-la-lkja-contrat-dengagement--ozld",
"mission-locale-de-la-lkja-la-mobilite-internat",
"mission-locale-de-la-lkja-la-mobilite-internat-fosy",
"mission-locale-de-la-lkja-la-mobilite-internat-dhwk",
"mission-locale-de-la-lkja-la-mobilite-internat-fjvw",
"mission-locale-de-la-lkja-pacea",
"mission-locale-de-la-lkja-pacea-dbmo",
"mission-locale-de-la-lkja-pacea-taiq",
"mission-locale-de-la-lkja-pacea-tnla",
"mission-locale-de-la-lkja-parrainage-dxvn",
"mission-locale-de-la-lkja-parrainage-qfcp",
"mission-locale-de-la-lkja-parrainage-qelk",
"mission-locale-de-la-lkja-parrainage",
"mission-locale-de-la-lkja-accompagnement-des-b",
"mission-locale-de-la-lkja-accueil-et-accompagn-xmux",
"mission-locale-de-la-lkja-accueil-et-accompagn-pnge",
"mission-locale-de-la-lkja-accueil-et-accompagn",
"mission-locale-de-la-lkja-accueil-et-accompagn-lmxq",
"mission-locale-de-la-lkja-accueil-et-accompagn-rjol",
"mission-locale-de-la-lkja-accueil-et-accompagn-daak",
"mission-locale-de-la-lkja-accueil-et-accompagn-gaws",
"mission-locale-de-la-lkja-bilan-de-sante-ndhz",
"mission-locale-de-la-lkja-bilan-de-sante-czfz",
"mission-locale-de-la-lkja-bilan-de-sante-qoii",
"mission-locale-de-la-lkja-bilan-de-sante",
"mission-locale-de-la-lkja-atelier-de-recherche-whyv",
"mission-locale-de-la-lkja-atelier-de-recherche-zjnw",
"mission-locale-de-la-lkja-atelier-de-recherche-praa",
"mission-locale-de-la-lkja-atelier-de-recherche",
"mission-locale-porte-les-talentueux",
"mission-locale-porte-mediation-numerique",
"mission-locale-porte-accompagnement-des-j-crgm",
"mission-locale-porte-accompagnement-des-j-riyp",
"mission-locale-porte-accompagnement-des-j-sjmq",
"mission-locale-porte-accompagnement-des-b",
"mission-locale-porte-accompagnement-des-a-ddjo",
"mission-locale-porte-atelier-marche-du-tr",
"mission-locale-porte-prendre-un-logement-",
"mission-locale-porte-atelier-cv",
"mission-locale-porte-atelier-lettre-de-mo",
"mission-locale-porte-parrainage",
"mission-locale-porte-atelier-nutrition-je",
"mission-locale-porte-atelier-les-institut",
"mission-locale-porte-pacea",
"mission-locale-porte-atelier-numerique",
"mission-locale-porte-bilans-de-sante",
"mission-locale-porte-psc1",
"nyonsaise-pour-accue-hebergement-durgence",
"nyonsaise-pour-accue-iml-ukraine",
"nyonsaise-pour-accue-alt",
"nyonsaise-pour-accue-accompagnement-vers-",
"nyonsaise-pour-accue-accueil-de-jour",
"organisme-assoc-sout-hebergement-pour-per-tteh",
"partenaires-vallee-d-accueil-et-accompagn-snki",
"partenaires-vallee-d-accueil-et-accompagn-hvog",
"partenaires-vallee-d-accueil-et-accompagn-etvw",
"partenaires-vallee-d-accueil-et-accompagn-dniz",
"partenaires-vallee-d-accueil-et-accompagn-rgzm",
"partenaires-vallee-d-accueil-et-accompagn-brnl",
"partenaires-vallee-d-bilans-de-sante",
"pimms-portes-de-prov-materiel-informatiqu",
"pimms-portes-de-prov-mediation-numerique-lniu",
"solstice-une-image-de-soi-au-",
"diaconat-protestant-wtar-dispositif-incurie-d",
"diaconat-protestant-wtar-domiciliation-val-ac",
"diaconat-protestant-wtar-post-chrs-val-accuei",
"diaconat-protestant-wtar-chrs-val-accueil",
"diaconat-protestant-wtar-pension-de-famille-l",
"diaconat-protestant-wtar-mesures-liees-a-lacc",
"diaconat-protestant-wtar-accueil-de-jour-val-",
]


def create_funding_labels(apps, schema_editor):
# Récupération des modèles
FundingLabel = apps.get_model("services", "FundingLabel")
Service = apps.get_model("services", "Service")

funding_label_cd_aveyron = FundingLabel.objects.create(
label="Conseil départemental de l’Aveyron", value="cd-aveyron"
)
funding_label_cd_drome = FundingLabel.objects.create(
label="Conseil départemental de la Drôme", value="cd-drome"
)

funded_services_aveyron = Service.objects.filter(
slug__in=FUNDED_SERVICE_SLUGS_AVEYRON
)
funded_services_drome = Service.objects.filter(slug__in=FUNDED_SERVICE_SLUGS_DROME)

for service in funded_services_aveyron:
service.funding_labels.add(funding_label_cd_aveyron)

for service in funded_services_drome:
service.funding_labels.add(funding_label_cd_drome)


def delete_funding_labels(apps, schema_editor):
FundingLabel = apps.get_model("services", "FundingLabel")

FundingLabel.objects.filter(value__in=("cd-aveyron", "cd-drome")).delete()


class Migration(migrations.Migration):
dependencies = [
("services", "0111_fundinglabel_service_funding_labels"),
]

operations = [
migrations.RunPython(create_funding_labels, reverse_code=delete_funding_labels),
]

0 comments on commit 66a9b5a

Please sign in to comment.