summaryrefslogtreecommitdiff
path: root/archaeological_context_records
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_context_records')
-rw-r--r--archaeological_context_records/migrations/0121_add_hierarchy_documentations_excavation_technics.py42
-rw-r--r--archaeological_context_records/models.py8
2 files changed, 46 insertions, 4 deletions
diff --git a/archaeological_context_records/migrations/0121_add_hierarchy_documentations_excavation_technics.py b/archaeological_context_records/migrations/0121_add_hierarchy_documentations_excavation_technics.py
new file mode 100644
index 000000000..0aeb2b46d
--- /dev/null
+++ b/archaeological_context_records/migrations/0121_add_hierarchy_documentations_excavation_technics.py
@@ -0,0 +1,42 @@
+# Generated by Django 2.2.24 on 2024-09-23 14:48
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_context_records', '0120_excavator'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='documentationtype',
+ options={'ordering': ('order', 'label'), 'verbose_name': 'Documentation type', 'verbose_name_plural': 'Documentation types'},
+ ),
+ migrations.AlterModelOptions(
+ name='excavationtechnictype',
+ options={'ordering': ('order', 'label'), 'verbose_name': 'Excavation technique type', 'verbose_name_plural': 'Excavation technique types'},
+ ),
+ migrations.AddField(
+ model_name='documentationtype',
+ name='order',
+ field=models.IntegerField(default=10, verbose_name='Order'),
+ ),
+ migrations.AddField(
+ model_name='documentationtype',
+ name='parent',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_context_records.DocumentationType', verbose_name='Parent'),
+ ),
+ migrations.AddField(
+ model_name='excavationtechnictype',
+ name='order',
+ field=models.IntegerField(default=10, verbose_name='Order'),
+ ),
+ migrations.AddField(
+ model_name='excavationtechnictype',
+ name='parent',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_context_records.ExcavationTechnicType', verbose_name='Parent'),
+ ),
+ ]
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index efef8cce0..90f961c0a 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -404,22 +404,22 @@ post_save.connect(post_save_cache, sender=InclusionType)
post_delete.connect(post_save_cache, sender=InclusionType)
-class ExcavationTechnicType(GeneralType):
+class ExcavationTechnicType(OrderedHierarchicalType):
class Meta:
verbose_name = _("Excavation technique type")
verbose_name_plural = _("Excavation technique types")
- ordering = ("label",)
+ ordering = ("order", "label")
post_save.connect(post_save_cache, sender=ExcavationTechnicType)
post_delete.connect(post_save_cache, sender=ExcavationTechnicType)
-class DocumentationType(GeneralType):
+class DocumentationType(OrderedHierarchicalType):
class Meta:
verbose_name = _("Documentation type")
verbose_name_plural = _("Documentation types")
- ordering = ("label",)
+ ordering = ("order", "label")
post_save.connect(post_save_cache, sender=DocumentationType)