diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-10-02 23:51:34 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-10-02 23:51:34 +0200 |
commit | 33519e29e7a4151a3792f4892898ae5edc847807 (patch) | |
tree | 5ebf3d145585bc97b690da02abc27c223ee65248 | |
parent | 2be0901eb641a06231920bcc10298d1d9e2957b4 (diff) | |
download | Ishtar-33519e29e7a4151a3792f4892898ae5edc847807.tar.bz2 Ishtar-33519e29e7a4151a3792f4892898ae5edc847807.zip |
🐛 fix migration
-rw-r--r-- | archaeological_finds/migrations/0141_data_migration_recommanded_treatments.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/archaeological_finds/migrations/0141_data_migration_recommanded_treatments.py b/archaeological_finds/migrations/0141_data_migration_recommanded_treatments.py index 034c34a4c..9fcc41f6a 100644 --- a/archaeological_finds/migrations/0141_data_migration_recommanded_treatments.py +++ b/archaeological_finds/migrations/0141_data_migration_recommanded_treatments.py @@ -25,9 +25,12 @@ def load_data(apps, __): for find in q.all(): for treatment_type in find.preservation_to_considers.all(): if treatment_type.txt_idx not in reco: + slug = treatment_type.txt_idx + while RecommendedTreatmentType.objects.filter(txt_idx=slug).count(): + slug += "1" reco[treatment_type.txt_idx] = RecommendedTreatmentType.objects.create( label=treatment_type.label, - txt_idx=treatment_type.txt_idx, + txt_idx=slug, parent=parent ) find.recommended_treatments.add(reco[treatment_type.txt_idx]) |