diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-11-28 13:59:50 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-11-28 13:59:50 +0100 |
commit | 959e8ac458a0379636df15ff851e30f0096f8bff (patch) | |
tree | 57a7939b44912642cca59f3c9a157e9fd98ac57f | |
parent | 81be8409742e3a3939b3c90311550d208bcf42e1 (diff) | |
download | Ishtar-959e8ac458a0379636df15ff851e30f0096f8bff.tar.bz2 Ishtar-959e8ac458a0379636df15ff851e30f0096f8bff.zip |
🐛 Instance Profile - fix migration: provide default for complete id and cached label (refs #5674)
-rw-r--r-- | changelog/en/changelog_2022-06-15.md | 1 | ||||
-rw-r--r-- | changelog/fr/changelog_2023-01-25.md | 1 | ||||
-rw-r--r-- | ishtar_common/migrations/0231_set_default_profile_value.py | 30 |
3 files changed, 32 insertions, 0 deletions
diff --git a/changelog/en/changelog_2022-06-15.md b/changelog/en/changelog_2022-06-15.md index 1bda32c6a..737967018 100644 --- a/changelog/en/changelog_2022-06-15.md +++ b/changelog/en/changelog_2022-06-15.md @@ -3,6 +3,7 @@ v4.0.67 - 2023-11-28 ### Bug fixes ### - GIS form - remove "timestamp" fields (#5673) +- Instance Profile - fix migration: provide default for complete id and cached label (#5674) v4.0.66 - 2023-11-22 -------------------- diff --git a/changelog/fr/changelog_2023-01-25.md b/changelog/fr/changelog_2023-01-25.md index a0d601158..16767cca8 100644 --- a/changelog/fr/changelog_2023-01-25.md +++ b/changelog/fr/changelog_2023-01-25.md @@ -3,6 +3,7 @@ v4.0.67 - 2023-11-28 ### Corrections de dysfonctionnements ### - Formulaire SIG - suppression des champs "horodatage" (#5673) +- Profile d'instance - correction de migration de base de données : valeur par défaut pour l'identifiant complet et le libellé mise en cache (#5674) v4.0.66 - 2023-11-22 -------------------- diff --git a/ishtar_common/migrations/0231_set_default_profile_value.py b/ishtar_common/migrations/0231_set_default_profile_value.py new file mode 100644 index 000000000..2e77e5c7f --- /dev/null +++ b/ishtar_common/migrations/0231_set_default_profile_value.py @@ -0,0 +1,30 @@ +# Generated by Django 2.2.24 on 2023-11-28 13:21 + +from django.db import migrations + + +def set_default_profile_value(apps, __): + model = apps.get_model("ishtar_common", "ishtarsiteprofile") + attrs = ["operation_complete_identifier", "operation_cached_label", + "contextrecord_cached_label", "parcel_cached_label", + "find_cached_label"] + for profile in model.objects.all(): + changed = False + for attr in attrs: + if not getattr(profile, attr): + field = model._meta.get_field(attr) + setattr(profile, attr, field.get_default()) + changed = True + if changed: + profile.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('ishtar_common', '0230_auto_20231114_1334'), + ] + + operations = [ + migrations.RunPython(set_default_profile_value) + ] |