diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-09-23 15:24:16 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-09-26 11:25:21 +0200 |
commit | defd93897c0999cacf72bcc992551c49b7cbde22 (patch) | |
tree | ea45579ae805c742de123a5e20f035eb3c5a3875 /archaeological_context_records | |
parent | 440038531ae041a4800b11921197616c34f577f2 (diff) | |
download | Ishtar-defd93897c0999cacf72bcc992551c49b7cbde22.tar.bz2 Ishtar-defd93897c0999cacf72bcc992551c49b7cbde22.zip |
Context record: DocumentationType, ExcavationTechnic add hierarchy and order
Diffstat (limited to 'archaeological_context_records')
-rw-r--r-- | archaeological_context_records/migrations/0121_add_hierarchy_documentations_excavation_technics.py | 42 | ||||
-rw-r--r-- | archaeological_context_records/models.py | 8 |
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) |