From 33519e29e7a4151a3792f4892898ae5edc847807 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 2 Oct 2025 23:51:34 +0200 Subject: 🐛 fix migration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0141_data_migration_recommanded_treatments.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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]) -- cgit v1.2.3