summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archaeological_finds/migrations/0151_data_migration.json30
-rw-r--r--archaeological_finds/migrations/0151_data_migration_find_relation_type.py24
-rw-r--r--ishtar_common/models.py3
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"]