diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-04-07 10:57:49 +0200 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-04-07 19:25:04 +0200 |
| commit | 1515521ec11a29fa463bb0988d1663b6a8cb03ea (patch) | |
| tree | ff9abe6df7d63f3ce92f1f90cf63f160ba99afd0 | |
| parent | 5274764a21a4906f13808309fbdd446cf40861f7 (diff) | |
| download | Ishtar-1515521ec11a29fa463bb0988d1663b6a8cb03ea.tar.bz2 Ishtar-1515521ec11a29fa463bb0988d1663b6a8cb03ea.zip | |
🗃️ update default data for find relation typesdevelop-5.0-BPCdevelop-5.0
| -rw-r--r-- | archaeological_finds/migrations/0151_data_migration.json | 30 | ||||
| -rw-r--r-- | archaeological_finds/migrations/0151_data_migration_find_relation_type.py | 24 | ||||
| -rw-r--r-- | ishtar_common/models.py | 3 |
3 files changed, 57 insertions, 0 deletions
diff --git a/archaeological_finds/migrations/0151_data_migration.json b/archaeological_finds/migrations/0151_data_migration.json new file mode 100644 index 000000000..58dd88c85 --- /dev/null +++ b/archaeological_finds/migrations/0151_data_migration.json @@ -0,0 +1,30 @@ +[ + { + "model": "archaeological_finds.findrelationtype", + "fields": { + "label": "Recolle avec", + "txt_idx": "recolle-avec", + "comment": "", + "available": true, + "order": 10, + "symmetrical": true, + "tiny_label": null, + "inverse_relation": null, + "logical_relation": null + } + }, + { + "model": "archaeological_finds.findrelationtype", + "fields": { + "label": "Voisin de", + "txt_idx": "voisin-de", + "comment": "", + "available": true, + "order": 10, + "symmetrical": true, + "tiny_label": null, + "inverse_relation": null, + "logical_relation": null + } + } +] diff --git a/archaeological_finds/migrations/0151_data_migration_find_relation_type.py b/archaeological_finds/migrations/0151_data_migration_find_relation_type.py new file mode 100644 index 000000000..f3a1c1b4e --- /dev/null +++ b/archaeological_finds/migrations/0151_data_migration_find_relation_type.py @@ -0,0 +1,24 @@ +# Generated by Django 2.2.24 on 2024-02-10 12:07 + +import os + +from django.db import migrations +from django.core.management import call_command + + +def load_data(apps, __): + FindRelationtypeType = apps.get_model("archaeological_finds", "findrelationtype") + if not FindRelationtypeType.objects.count(): + json_path = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-1] + ["0151_data_migration.json"]) + call_command("loaddata", json_path) + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_finds', '0150_findrelationtype_findrecordrelations'), + ] + + operations = [ + migrations.RunPython(load_data) + ] diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 5b06baba2..2d00f3455 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -887,6 +887,9 @@ class GeneralRecordRelations(Imported): class Meta: abstract = True + def __str__(self): + return f"{self.left_record} - {self.relation_type} - {self.right_record}" + @classmethod def general_types(cls): return ["relation_type"] |
