diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-09-19 12:56:18 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-09-20 15:47:07 +0200 |
commit | 9e7b90546562144abc2c7195743ec34507f57cc2 (patch) | |
tree | 2e249bcdab3b92763d5723a957a16209105c0c22 | |
parent | c10cdd8220589a4ce5bed01bc08cd11c92fdcdb5 (diff) | |
download | Ishtar-9e7b90546562144abc2c7195743ec34507f57cc2.tar.bz2 Ishtar-9e7b90546562144abc2c7195743ec34507f57cc2.zip |
🗃️ archaeological sites: new fields in database
- Types
- Current status
- Discovery status
- Discoverer
- Nature of site
- Interpretation level
- Precise locality
- Description
- Public description
13 files changed, 1669 insertions, 16 deletions
diff --git a/Makefile.example b/Makefile.example index 305eb0782..3a5bf220b 100644 --- a/Makefile.example +++ b/Makefile.example @@ -266,10 +266,15 @@ fixtures_operations: cd $(project); $(PYTHON) ./manage.py dumpdata --indent 4 --natural-primary --natural-foreign \ archaeological_operations.acttype \ archaeological_operations.period \ + archaeological_operations.sitetype \ archaeological_operations.remaintype \ archaeological_operations.reportstate \ archaeological_operations.recordqualitytype \ archaeological_operations.culturalattributiontype \ + archaeological_operations.sitecurrentstatustype \ + archaeological_operations.sitediscoverystatustype \ + archaeological_operations.natureofsitetype \ + archaeological_operations.interpretationleveltype \ > '../archaeological_operations/fixtures/initial_data-'$(default_data)'.json' cd $(project); $(PYTHON) ./manage.py dumpdata --indent 4 --natural-primary --natural-foreign \ archaeological_operations.relationtype \ diff --git a/archaeological_context_records/migrations/0119_default_typos.py b/archaeological_context_records/migrations/0119_default_typos.py index bdfa927ca..85d0b2b49 100644 --- a/archaeological_context_records/migrations/0119_default_typos.py +++ b/archaeological_context_records/migrations/0119_default_typos.py @@ -1,7 +1,7 @@ # Generated by Django 2.2.24 on 2024-03-25 17:24 from django.db import migrations -from ishtar_common.utils import migrations_load_data +from ishtar_common.utils_migrations import migrations_load_data def load_data(apps, __): diff --git a/archaeological_operations/admin.py b/archaeological_operations/admin.py index 40d275d83..346349303 100644 --- a/archaeological_operations/admin.py +++ b/archaeological_operations/admin.py @@ -203,6 +203,7 @@ admin_site.register(models.CulturalAttributionType, CulturalAttributionTypeAdmin) -general_models = [models.RemainType] +general_models = [models.RemainType, models.NatureOfSiteType, models.InterpretationLevelType, + models.SiteCurrentStatusType, models.SiteDiscoveryStatusType, models.SiteType] for model in general_models: admin_site.register(model, GeneralTypeAdmin) diff --git a/archaeological_operations/migrations/0119_site_status_nature_interpretation.py b/archaeological_operations/migrations/0119_site_status_nature_interpretation.py new file mode 100644 index 000000000..a3681c018 --- /dev/null +++ b/archaeological_operations/migrations/0119_site_status_nature_interpretation.py @@ -0,0 +1,235 @@ +# Generated by Django 2.2.24 on 2024-09-19 16:27 + +import django.core.validators +from django.db import migrations, models +import django.db.models.deletion +import ishtar_common.models_common +import re + + +class Migration(migrations.Migration): + + dependencies = [ + ('ishtar_common', '0249_town_notice'), + ('archaeological_operations', '0118_operator_reference_length'), + ] + + operations = [ + migrations.CreateModel( + name='InterpretationLevelType', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('label', models.TextField(verbose_name='Label')), + ('txt_idx', models.TextField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID')), + ('comment', models.TextField(blank=True, default='', verbose_name='Comment')), + ('available', models.BooleanField(default=True, verbose_name='Available')), + ('order', models.IntegerField(default=10, verbose_name='Order')), + ], + options={ + 'verbose_name': 'Interpretation level type', + 'verbose_name_plural': 'Interpretation level types', + 'ordering': ('order', 'label'), + }, + bases=(ishtar_common.models_common.Cached, models.Model), + ), + migrations.CreateModel( + name='NatureOfSiteType', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('label', models.TextField(verbose_name='Label')), + ('txt_idx', models.TextField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID')), + ('comment', models.TextField(blank=True, default='', verbose_name='Comment')), + ('available', models.BooleanField(default=True, verbose_name='Available')), + ('order', models.IntegerField(default=10, verbose_name='Order')), + ], + options={ + 'verbose_name': 'Nature of site type', + 'verbose_name_plural': 'Nature of site types', + 'ordering': ('order', 'label'), + }, + bases=(ishtar_common.models_common.Cached, models.Model), + ), + migrations.CreateModel( + name='SiteCurrentStatusType', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('label', models.TextField(verbose_name='Label')), + ('txt_idx', models.TextField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID')), + ('comment', models.TextField(blank=True, default='', verbose_name='Comment')), + ('available', models.BooleanField(default=True, verbose_name='Available')), + ('order', models.IntegerField(default=10, verbose_name='Order')), + ], + options={ + 'verbose_name': 'Current status type', + 'verbose_name_plural': 'Current status types', + 'ordering': ('order', 'label'), + }, + bases=(ishtar_common.models_common.Cached, models.Model), + ), + migrations.CreateModel( + name='SiteDiscoveryStatusType', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('label', models.TextField(verbose_name='Label')), + ('txt_idx', models.TextField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID')), + ('comment', models.TextField(blank=True, default='', verbose_name='Comment')), + ('available', models.BooleanField(default=True, verbose_name='Available')), + ('order', models.IntegerField(default=10, verbose_name='Order')), + ], + options={ + 'verbose_name': 'Discovery status type', + 'verbose_name_plural': 'Discovery status types', + 'ordering': ('order', 'label'), + }, + bases=(ishtar_common.models_common.Cached, models.Model), + ), + migrations.AlterModelOptions( + name='culturalattributiontype', + options={'ordering': ('order', 'label'), 'verbose_name': 'Cultural attribution type', 'verbose_name_plural': 'Cultural attribution types'}, + ), + migrations.AlterModelOptions( + name='period', + options={'ordering': ('order', 'label'), 'verbose_name': 'Type Period', 'verbose_name_plural': 'Types Period'}, + ), + migrations.AlterModelOptions( + name='recordqualitytype', + options={'ordering': ('order', 'label'), 'verbose_name': 'Type of record quality', 'verbose_name_plural': 'Types of record quality'}, + ), + migrations.AlterModelOptions( + name='reportstate', + options={'ordering': ('order', 'label'), 'verbose_name': 'Type of report state', 'verbose_name_plural': 'Types of report state'}, + ), + migrations.AddField( + model_name='archaeologicalsite', + name='description', + field=models.TextField(blank=True, default='', verbose_name='Description'), + ), + migrations.AddField( + model_name='archaeologicalsite', + name='discoverer', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='ishtar_common.Person', verbose_name='Discoverer'), + ), + migrations.AddField( + model_name='archaeologicalsite', + name='precise_locality', + field=models.TextField(blank=True, default='', verbose_name='Precise locality'), + ), + migrations.AddField( + model_name='archaeologicalsite', + name='public_description', + field=models.TextField(blank=True, default='', verbose_name='Public description'), + ), + migrations.AddField( + model_name='historicalarchaeologicalsite', + name='description', + field=models.TextField(blank=True, default='', verbose_name='Description'), + ), + migrations.AddField( + model_name='historicalarchaeologicalsite', + name='discoverer', + field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='ishtar_common.Person', verbose_name='Discoverer'), + ), + migrations.AddField( + model_name='historicalarchaeologicalsite', + name='precise_locality', + field=models.TextField(blank=True, default='', verbose_name='Precise locality'), + ), + migrations.AddField( + model_name='historicalarchaeologicalsite', + name='public_description', + field=models.TextField(blank=True, default='', verbose_name='Public description'), + ), + migrations.AlterField( + model_name='administrativeact', + name='scientist', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='adminact_scientist', to='ishtar_common.Person', verbose_name='Head scientist'), + ), + migrations.AlterField( + model_name='historicaladministrativeact', + name='scientist', + field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='ishtar_common.Person', verbose_name='Head scientist'), + ), + migrations.AlterField( + model_name='historicaloperation', + name='in_charge', + field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='ishtar_common.Person', verbose_name='Scientific monitor'), + ), + migrations.AlterField( + model_name='historicaloperation', + name='scientist', + field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='ishtar_common.Person', verbose_name='Head scientist'), + ), + migrations.AlterField( + model_name='operation', + name='in_charge', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='operation_monitoring', to='ishtar_common.Person', verbose_name='Scientific monitor'), + ), + migrations.AlterField( + model_name='operation', + name='scientist', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='operation_scientist_responsability', to='ishtar_common.Person', verbose_name='Head scientist'), + ), + migrations.CreateModel( + name='SiteType', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('label', models.TextField(verbose_name='Label')), + ('txt_idx', models.TextField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID')), + ('comment', models.TextField(blank=True, default='', verbose_name='Comment')), + ('available', models.BooleanField(default=True, verbose_name='Available')), + ('order', models.IntegerField(default=10, verbose_name='Order')), + ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_operations.SiteType', verbose_name='Parent')), + ], + options={ + 'verbose_name': 'Site type', + 'verbose_name_plural': 'Site types', + 'ordering': ('order', 'label'), + }, + bases=(ishtar_common.models_common.Cached, models.Model), + ), + migrations.AddField( + model_name='archaeologicalsite', + name='current_status', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_operations.SiteCurrentStatusType', verbose_name='Current status'), + ), + migrations.AddField( + model_name='archaeologicalsite', + name='discovery_status', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_operations.SiteDiscoveryStatusType', verbose_name='Discovery status'), + ), + migrations.AddField( + model_name='archaeologicalsite', + name='interpretation_level', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_operations.InterpretationLevelType', verbose_name='Interpretation level'), + ), + migrations.AddField( + model_name='archaeologicalsite', + name='nature_of_site', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_operations.NatureOfSiteType', verbose_name='Nature of site'), + ), + migrations.AddField( + model_name='archaeologicalsite', + name='types', + field=models.ManyToManyField(blank=True, to='archaeological_operations.SiteType', verbose_name='Types'), + ), + migrations.AddField( + model_name='historicalarchaeologicalsite', + name='current_status', + field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='archaeological_operations.SiteCurrentStatusType', verbose_name='Current status'), + ), + migrations.AddField( + model_name='historicalarchaeologicalsite', + name='discovery_status', + field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='archaeological_operations.SiteDiscoveryStatusType', verbose_name='Discovery status'), + ), + migrations.AddField( + model_name='historicalarchaeologicalsite', + name='interpretation_level', + field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='archaeological_operations.InterpretationLevelType', verbose_name='Interpretation level'), + ), + migrations.AddField( + model_name='historicalarchaeologicalsite', + name='nature_of_site', + field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='archaeological_operations.NatureOfSiteType', verbose_name='Nature of site'), + ), + ] diff --git a/archaeological_operations/migrations/0120_data_site_interpretation.json b/archaeological_operations/migrations/0120_data_site_interpretation.json new file mode 100644 index 000000000..83887a5dc --- /dev/null +++ b/archaeological_operations/migrations/0120_data_site_interpretation.json @@ -0,0 +1,32 @@ +[ +{ + "model": "archaeological_operations.interpretationleveltype", + "fields": { + "label": "D\u00e9couverte isol\u00e9e", + "txt_idx": "decouverte-isolee", + "comment": "", + "available": true, + "order": 10 + } +}, +{ + "model": "archaeological_operations.interpretationleveltype", + "fields": { + "label": "Indice d'occupation", + "txt_idx": "indice-doccupation", + "comment": "", + "available": true, + "order": 20 + } +}, +{ + "model": "archaeological_operations.interpretationleveltype", + "fields": { + "label": "Site fonctionnel", + "txt_idx": "site-fonctionnel", + "comment": "", + "available": true, + "order": 30 + } +} +] diff --git a/archaeological_operations/migrations/0120_data_site_nature.json b/archaeological_operations/migrations/0120_data_site_nature.json new file mode 100644 index 000000000..21a2b23eb --- /dev/null +++ b/archaeological_operations/migrations/0120_data_site_nature.json @@ -0,0 +1,32 @@ +[ +{ + "model": "archaeological_operations.natureofsitetype", + "fields": { + "label": "En surface", + "txt_idx": "en-surface", + "comment": "", + "available": true, + "order": 10 + } +}, +{ + "model": "archaeological_operations.natureofsitetype", + "fields": { + "label": "Enfoui", + "txt_idx": "enfoui", + "comment": "", + "available": true, + "order": 20 + } +}, +{ + "model": "archaeological_operations.natureofsitetype", + "fields": { + "label": "Hors du sol", + "txt_idx": "hors-du-sol", + "comment": "", + "available": true, + "order": 30 + } +} +] diff --git a/archaeological_operations/migrations/0120_data_site_status.json b/archaeological_operations/migrations/0120_data_site_status.json new file mode 100644 index 000000000..4bfd21db8 --- /dev/null +++ b/archaeological_operations/migrations/0120_data_site_status.json @@ -0,0 +1,62 @@ +[ +{ + "model": "archaeological_operations.sitecurrentstatustype", + "fields": { + "label": "Conserv\u00e9", + "txt_idx": "conserve", + "comment": "", + "available": true, + "order": 10 + } +}, +{ + "model": "archaeological_operations.sitecurrentstatustype", + "fields": { + "label": "D\u00e9truit", + "txt_idx": "detruit", + "comment": "", + "available": true, + "order": 20 + } +}, +{ + "model": "archaeological_operations.sitecurrentstatustype", + "fields": { + "label": "Inconnu", + "txt_idx": "inconnu", + "comment": "", + "available": true, + "order": 30 + } +}, +{ + "model": "archaeological_operations.sitediscoverystatustype", + "fields": { + "label": "Inorganis\u00e9", + "txt_idx": "inorganise", + "comment": "", + "available": true, + "order": 10 + } +}, +{ + "model": "archaeological_operations.sitediscoverystatustype", + "fields": { + "label": "Sans objet", + "txt_idx": "sans-objet", + "comment": "", + "available": true, + "order": 20 + } +}, +{ + "model": "archaeological_operations.sitediscoverystatustype", + "fields": { + "label": "Structur\u00e9", + "txt_idx": "structure", + "comment": "", + "available": true, + "order": 30 + } +} +] diff --git a/archaeological_operations/migrations/0120_data_site_status_nature_interpretation.py b/archaeological_operations/migrations/0120_data_site_status_nature_interpretation.py new file mode 100644 index 000000000..9840b6b7e --- /dev/null +++ b/archaeological_operations/migrations/0120_data_site_status_nature_interpretation.py @@ -0,0 +1,34 @@ +from django.db import migrations +from ishtar_common.utils_migrations import migrations_load_data + + +def load_data(apps, __): + module_name = "archaeological_operations" + SiteCurrentStatusType = apps.get_model(module_name, "SiteCurrentStatusType") + SiteDiscoveryStatusType = apps.get_model(module_name, "SiteDiscoveryStatusType") + if not SiteDiscoveryStatusType.objects.count() or not SiteCurrentStatusType.objects.count(): + json_file = "0120_data_site_status.json" + migrations_load_data(module_name, json_file) + NatureOfSiteType = apps.get_model("archaeological_operations", "NatureOfSiteType") + if not NatureOfSiteType.objects.count(): + json_file = "0120_data_site_nature.json" + migrations_load_data(module_name, json_file) + InterpretationLevelType = apps.get_model("archaeological_operations", "InterpretationLevelType") + if not InterpretationLevelType.objects.count(): + json_file = "0120_data_site_interpretation.json" + migrations_load_data(module_name, json_file) + SiteType = apps.get_model("archaeological_operations", "SiteType") + if not SiteType.objects.count(): + json_file = "0120_data_site_type.json" + migrations_load_data(module_name, json_file) + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_operations', '0119_site_status_nature_interpretation'), + ] + + operations = [ + migrations.RunPython(load_data) + ] diff --git a/archaeological_operations/migrations/0120_data_site_type.json b/archaeological_operations/migrations/0120_data_site_type.json new file mode 100644 index 000000000..0f898c0e8 --- /dev/null +++ b/archaeological_operations/migrations/0120_data_site_type.json @@ -0,0 +1,1168 @@ +[ +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "abbaye", + "txt_idx": "abbaye", + "comment": "", + "available": true, + "order": 10, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "agglom\u00e9ration secondaire antique", + "txt_idx": "agglomeration-secondaire-antique", + "comment": "", + "available": true, + "order": 20, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "alluvion", + "txt_idx": "alluvion", + "comment": "", + "available": true, + "order": 30, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "am\u00e9nagement de berge", + "txt_idx": "amenagement-de-berge", + "comment": "", + "available": true, + "order": 40, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "aqueduc", + "txt_idx": "aqueduc", + "comment": "", + "available": true, + "order": 50, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "atelier de d\u00e9bitage", + "txt_idx": "atelier-de-debitage", + "comment": "", + "available": true, + "order": 60, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "atelier de p\u00e2tenotrier", + "txt_idx": "atelier-de-patenotrier", + "comment": "", + "available": true, + "order": 70, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "atelier m\u00e9tallurgique", + "txt_idx": "atelier-metallurgique", + "comment": "", + "available": true, + "order": 80, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "b\u00e2timent", + "txt_idx": "batiment", + "comment": "", + "available": true, + "order": 90, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "b\u00e2timent conventuel", + "txt_idx": "batiment-conventuel", + "comment": "", + "available": true, + "order": 100, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "bornage", + "txt_idx": "bornage", + "comment": "", + "available": true, + "order": 110, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "boucherie", + "txt_idx": "boucherie", + "comment": "", + "available": true, + "order": 120, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "bourg monastique", + "txt_idx": "bourg-monastique", + "comment": "", + "available": true, + "order": 130, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "bourgade protohistorique", + "txt_idx": "bourgade-protohistorique", + "comment": "", + "available": true, + "order": 140, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "briqueterie", + "txt_idx": "briqueterie", + "comment": "", + "available": true, + "order": 150, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "bronze", + "txt_idx": "bronze", + "comment": "", + "available": true, + "order": 160, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "cabane", + "txt_idx": "cabane", + "comment": "", + "available": true, + "order": 170, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "campement", + "txt_idx": "campement", + "comment": "", + "available": true, + "order": 180, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "carri\u00e8re", + "txt_idx": "carriere", + "comment": "", + "available": true, + "order": 190, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "caserne", + "txt_idx": "caserne", + "comment": "", + "available": true, + "order": 200, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "cave", + "txt_idx": "cave", + "comment": "", + "available": true, + "order": 210, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "centre domanial", + "txt_idx": "centre-domanial", + "comment": "", + "available": true, + "order": 220, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "champ de foire", + "txt_idx": "champ-de-foire", + "comment": "", + "available": true, + "order": 230, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "chapelle", + "txt_idx": "chapelle", + "comment": "", + "available": true, + "order": 240, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "ch\u00e2teau", + "txt_idx": "chateau", + "comment": "", + "available": true, + "order": 250, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "chemin", + "txt_idx": "chemin", + "comment": "", + "available": true, + "order": 260, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "cimeti\u00e8re", + "txt_idx": "cimetiere", + "comment": "", + "available": true, + "order": 270, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "clo\u00eetre", + "txt_idx": "cloitre", + "comment": "", + "available": true, + "order": 280, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "coll\u00e9giale", + "txt_idx": "collegiale", + "comment": "", + "available": true, + "order": 290, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "couvent", + "txt_idx": "couvent", + "comment": "", + "available": true, + "order": 300, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "croix de chemin", + "txt_idx": "croix-de-chemin", + "comment": "", + "available": true, + "order": 310, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "croix de cimeti\u00e8re", + "txt_idx": "croix-de-cimetiere", + "comment": "", + "available": true, + "order": 320, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "croix monumentale", + "txt_idx": "croix-monumentale", + "comment": "", + "available": true, + "order": 330, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "culture mara\u00eech\u00e8re", + "txt_idx": "culture-maraichere", + "comment": "", + "available": true, + "order": 340, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "dortoir", + "txt_idx": "dortoir", + "comment": "", + "available": true, + "order": 350, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "\u00e9difice ou site non-identifi\u00e9", + "txt_idx": "edifice-ou-site-non-identifie", + "comment": "", + "available": true, + "order": 360, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "\u00e9glise", + "txt_idx": "eglise", + "comment": "", + "available": true, + "order": 370, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "enceinte", + "txt_idx": "enceinte", + "comment": "", + "available": true, + "order": 380, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "enceinte de terre et bois", + "txt_idx": "enceinte-de-terre-et-bois", + "comment": "", + "available": true, + "order": 390, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "enceinte urbaine", + "txt_idx": "enceinte-urbaine", + "comment": "", + "available": true, + "order": 400, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "enclos", + "txt_idx": "enclos", + "comment": "", + "available": true, + "order": 410, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "enclos fun\u00e9raire", + "txt_idx": "enclos-funeraire", + "comment": "", + "available": true, + "order": 420, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "ermitage", + "txt_idx": "ermitage", + "comment": "", + "available": true, + "order": 430, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "espace agricole", + "txt_idx": "espace-agricole", + "comment": "", + "available": true, + "order": 440, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "\u00e9tablissement rural ind\u00e9termin\u00e9", + "txt_idx": "etablissement-rural-indetermine", + "comment": "", + "available": true, + "order": 450, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "ferme", + "txt_idx": "ferme", + "comment": "", + "available": true, + "order": 460, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "ferme indig\u00e8ne", + "txt_idx": "ferme-indigene", + "comment": "", + "available": true, + "order": 470, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "ferme isol\u00e9e", + "txt_idx": "ferme-isolee", + "comment": "", + "available": true, + "order": 480, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "fonderie", + "txt_idx": "fonderie", + "comment": "", + "available": true, + "order": 490, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "forge artisanale", + "txt_idx": "forge-artisanale", + "comment": "", + "available": true, + "order": 500, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "fosse", + "txt_idx": "fosse", + "comment": "", + "available": true, + "order": 510, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "foss\u00e9 d\u00e9fensif", + "txt_idx": "fosse-defensif", + "comment": "", + "available": true, + "order": 520, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "foss\u00e9 parcellaire / de drainage", + "txt_idx": "fosse-parcellaire-de-drainage", + "comment": "", + "available": true, + "order": 530, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "fourches patibulaires", + "txt_idx": "fourches-patibulaires", + "comment": "", + "available": true, + "order": 540, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "gord", + "txt_idx": "gord", + "comment": "", + "available": true, + "order": 550, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "grange", + "txt_idx": "grange", + "comment": "", + "available": true, + "order": 560, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "grange aux d\u00eemes", + "txt_idx": "grange-aux-dimes", + "comment": "", + "available": true, + "order": 570, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "gu\u00e9", + "txt_idx": "gue", + "comment": "", + "available": true, + "order": 580, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "halle", + "txt_idx": "halle", + "comment": "", + "available": true, + "order": 590, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "hameau", + "txt_idx": "hameau", + "comment": "", + "available": true, + "order": 600, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "h\u00f4pital", + "txt_idx": "hopital", + "comment": "", + "available": true, + "order": 610, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "horticulture", + "txt_idx": "horticulture", + "comment": "", + "available": true, + "order": 620, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "h\u00f4tel-Dieu", + "txt_idx": "hotel-dieu", + "comment": "", + "available": true, + "order": 630, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "h\u00f4tellerie", + "txt_idx": "hotellerie", + "comment": "", + "available": true, + "order": 640, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "infirmerie monastique", + "txt_idx": "infirmerie-monastique", + "comment": "", + "available": true, + "order": 650, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "inhumation", + "txt_idx": "inhumation", + "comment": "", + "available": true, + "order": 660, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "inhumation individuelle", + "txt_idx": "inhumation-individuelle", + "comment": "", + "available": true, + "order": 670, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "inhumation isol\u00e9e", + "txt_idx": "inhumation-isolee", + "comment": "", + "available": true, + "order": 680, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "jardin", + "txt_idx": "jardin", + "comment": "", + "available": true, + "order": 690, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "lavabo de clo\u00eetre", + "txt_idx": "lavabo-de-cloitre", + "comment": "", + "available": true, + "order": 700, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "l\u00e9proserie", + "txt_idx": "leproserie", + "comment": "", + "available": true, + "order": 710, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "maison", + "txt_idx": "maison", + "comment": "", + "available": true, + "order": 720, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "maison forte", + "txt_idx": "maison-forte", + "comment": "", + "available": true, + "order": 730, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "maladrerie", + "txt_idx": "maladrerie", + "comment": "", + "available": true, + "order": 740, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "manoir", + "txt_idx": "manoir", + "comment": "", + "available": true, + "order": 750, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "montjoie", + "txt_idx": "montjoie", + "comment": "", + "available": true, + "order": 760, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "moule \u00e0 cloche", + "txt_idx": "moule-a-cloche", + "comment": "", + "available": true, + "order": 770, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "moulin \u00e0 eau", + "txt_idx": "moulin-a-eau", + "comment": "", + "available": true, + "order": 780, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "moulin \u00e0 vent", + "txt_idx": "moulin-a-vent", + "comment": "", + "available": true, + "order": 790, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "n\u00e9cropole \u00e0 rang\u00e9es", + "txt_idx": "necropole-a-rangees", + "comment": "", + "available": true, + "order": 800, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "ouvrage d'entr\u00e9e", + "txt_idx": "ouvrage-dentree", + "comment": "", + "available": true, + "order": 810, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "palais", + "txt_idx": "palais", + "comment": "", + "available": true, + "order": 820, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "parcellaire", + "txt_idx": "parcellaire", + "comment": "", + "available": true, + "order": 830, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "pilori", + "txt_idx": "pilori", + "comment": "", + "available": true, + "order": 840, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "pl\u00e2tri\u00e8re", + "txt_idx": "platriere", + "comment": "", + "available": true, + "order": 850, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "pont", + "txt_idx": "pont", + "comment": "", + "available": true, + "order": 860, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "porte de ville", + "txt_idx": "porte-de-ville", + "comment": "", + "available": true, + "order": 870, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "pressoir \u00e0 vin", + "txt_idx": "pressoir-a-vin", + "comment": "", + "available": true, + "order": 880, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "prieur\u00e9", + "txt_idx": "prieure", + "comment": "", + "available": true, + "order": 890, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "prison", + "txt_idx": "prison", + "comment": "", + "available": true, + "order": 900, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "r\u00e9fectoire", + "txt_idx": "refectoire", + "comment": "", + "available": true, + "order": 910, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "regard", + "txt_idx": "regard", + "comment": "", + "available": true, + "order": 920, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "rivi\u00e8re am\u00e9nag\u00e9e", + "txt_idx": "riviere-amenagee", + "comment": "", + "available": true, + "order": 930, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "route", + "txt_idx": "route", + "comment": "", + "available": true, + "order": 940, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "secteur d'activit\u00e9 artisanale", + "txt_idx": "secteur-dactivite-artisanale", + "comment": "", + "available": true, + "order": 950, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "secteur urbain", + "txt_idx": "secteur-urbain", + "comment": "", + "available": true, + "order": 960, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "silo excav\u00e9", + "txt_idx": "silo-excave", + "comment": "", + "available": true, + "order": 970, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "st\u00e9arinerie", + "txt_idx": "stearinerie", + "comment": "", + "available": true, + "order": 980, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "tr\u00e9sor mon\u00e9taire", + "txt_idx": "tresor-monetaire", + "comment": "", + "available": true, + "order": 990, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "unit\u00e9 d'habitation", + "txt_idx": "unite-dhabitation", + "comment": "", + "available": true, + "order": 1000, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "vestiges mobiliers", + "txt_idx": "vestiges-mobiliers", + "comment": "", + "available": true, + "order": 1010, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "vigne", + "txt_idx": "vigne", + "comment": "", + "available": true, + "order": 1020, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "villa antique", + "txt_idx": "villa-antique", + "comment": "", + "available": true, + "order": 1030, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "village", + "txt_idx": "village", + "comment": "", + "available": true, + "order": 1040, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "voie ancienne", + "txt_idx": "voie-ancienne", + "comment": "", + "available": true, + "order": 1050, + "parent": null + } +}, +{ + "model": "archaeological_operations.sitetype", + "fields": { + "label": "voie antique", + "txt_idx": "voie-antique", + "comment": "", + "available": true, + "order": 1060, + "parent": null + } +} +] diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index d17e529a7..f4c12beb0 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -49,6 +49,8 @@ from ishtar_common.models import ( IshtarUser, LightHistorizedItem, OperationType, + OrderedHierarchicalType, + OrderedType, Organization, OwnPerms, Person, @@ -134,9 +136,48 @@ post_save.connect(post_save_cache, sender=ReportState) post_delete.connect(post_save_cache, sender=ReportState) -class SiteManager(models.Manager): - def get_by_natural_key(self, txt_idx): - return self.get(reference=txt_idx) +class SiteCurrentStatusType(OrderedType): + class Meta: + verbose_name = _("Current status type") + verbose_name_plural = _("Current status types") + ordering = ("order", "label") + + +post_save.connect(post_save_cache, sender=SiteCurrentStatusType) +post_delete.connect(post_save_cache, sender=SiteCurrentStatusType) + + +class SiteDiscoveryStatusType(OrderedType): + class Meta: + verbose_name = _("Discovery status type") + verbose_name_plural = _("Discovery status types") + ordering = ("order", "label") + + +post_save.connect(post_save_cache, sender=SiteDiscoveryStatusType) +post_delete.connect(post_save_cache, sender=SiteDiscoveryStatusType) + + +class NatureOfSiteType(OrderedType): + class Meta: + verbose_name = _("Nature of site type") + verbose_name_plural = _("Nature of site types") + ordering = ("order", "label") + + +post_save.connect(post_save_cache, sender=NatureOfSiteType) +post_delete.connect(post_save_cache, sender=NatureOfSiteType) + + +class InterpretationLevelType(OrderedType): + class Meta: + verbose_name = _("Interpretation level type") + verbose_name_plural = _("Interpretation level types") + ordering = ("order", "label") + + +post_save.connect(post_save_cache, sender=InterpretationLevelType) +post_delete.connect(post_save_cache, sender=InterpretationLevelType) class RecordQualityType(GeneralType): @@ -148,6 +189,10 @@ class RecordQualityType(GeneralType): ordering = ("order", "label") +post_save.connect(post_save_cache, sender=RecordQualityType) +post_delete.connect(post_save_cache, sender=RecordQualityType) + + class CulturalAttributionType(HierarchicalType): order = models.IntegerField(_("Order"), default=10) @@ -157,8 +202,19 @@ class CulturalAttributionType(HierarchicalType): ordering = ("order", "label") -post_save.connect(post_save_cache, sender=RecordQualityType) -post_delete.connect(post_save_cache, sender=RecordQualityType) +post_save.connect(post_save_cache, sender=CulturalAttributionType) +post_delete.connect(post_save_cache, sender=CulturalAttributionType) + + +class SiteType(OrderedHierarchicalType): + class Meta: + verbose_name = _("Site type") + verbose_name_plural = _("Site types") + ordering = ("order", "label") + + +post_save.connect(post_save_cache, sender=SiteType) +post_delete.connect(post_save_cache, sender=SiteType) class GeographicTownItem(GeoItem): @@ -278,6 +334,11 @@ class GeographicTownItem(GeoItem): return changed +class SiteManager(models.Manager): + def get_by_natural_key(self, txt_idx): + return self.get(reference=txt_idx) + + class ArchaeologicalSite( DocumentItem, BaseHistorizedItem, @@ -321,6 +382,8 @@ class ArchaeologicalSite( BASE_SEARCH_VECTORS = [ SearchVectorConfig("comment", "local"), + SearchVectorConfig("description", "local"), + SearchVectorConfig("precise_description", "local"), SearchVectorConfig("discovery_area", "local"), SearchVectorConfig("locality_cadastral", "local"), SearchVectorConfig("locality_ngi", "local"), @@ -336,6 +399,7 @@ class ArchaeologicalSite( M2M_SEARCH_VECTORS = [ SearchVectorConfig("periods__label", "local"), SearchVectorConfig("remains__label", "local"), + SearchVectorConfig("types__label", "local"), SearchVectorConfig("towns__name"), SearchVectorConfig("towns__numero_insee", "raw"), ] @@ -452,7 +516,7 @@ class ArchaeologicalSite( RELATIVE_SESSION_NAMES = [ ("operation", "operations__pk"), ] - HISTORICAL_M2M = ["periods", "remains", "towns", "cultural_attributions"] + HISTORICAL_M2M = ["periods", "remains", "towns", "cultural_attributions", "types"] CACHED_LABELS = [ "cached_label", "cached_towns_label", @@ -500,6 +564,7 @@ class ArchaeologicalSite( reference = models.CharField(_("Reference"), max_length=200, unique=True) other_reference = models.TextField(_("Other reference"), blank=True, default="") name = models.CharField(_("Name"), max_length=200, null=True, blank=True) + types = models.ManyToManyField("SiteType", verbose_name=_("Types"), blank=True) periods = models.ManyToManyField(Period, verbose_name=_("Periods"), blank=True) remains = models.ManyToManyField( "RemainType", verbose_name=_("Remains"), blank=True @@ -510,7 +575,26 @@ class ArchaeologicalSite( towns = models.ManyToManyField( Town, verbose_name=_("Towns"), related_name="sites", blank=True ) + current_status = models.ForeignKey( + SiteCurrentStatusType, verbose_name=_("Current status"), + on_delete=models.SET_NULL, blank=True, null=True + ) + discovery_status = models.ForeignKey( + SiteDiscoveryStatusType, verbose_name=_("Discovery status"), + on_delete=models.SET_NULL, blank=True, null=True + ) + discoverer = models.ForeignKey(Person, verbose_name=_("Discoverer"), on_delete=models.SET_NULL, + blank=True, null=True) + nature_of_site = models.ForeignKey(NatureOfSiteType, verbose_name=_("Nature of site"), + on_delete=models.SET_NULL, blank=True, null=True) + interpretation_level = models.ForeignKey( + InterpretationLevelType, verbose_name=_("Interpretation level"), + on_delete=models.SET_NULL, blank=True, null=True + ) comment = models.TextField(_("Comment"), blank=True, default="") + description = models.TextField(_("Description"), blank=True, default="") + public_description = models.TextField(_("Public description"), blank=True, default="") + precise_locality = models.TextField(_("Precise locality"), blank=True, default="") locality_ngi = models.TextField( _("National Geographic Institute locality"), blank=True, default="" ) diff --git a/ishtar_common/migrations/0243_default_biographicalnote_permissions.py b/ishtar_common/migrations/0243_default_biographicalnote_permissions.py index a5399d9a8..fe367dd4d 100644 --- a/ishtar_common/migrations/0243_default_biographicalnote_permissions.py +++ b/ishtar_common/migrations/0243_default_biographicalnote_permissions.py @@ -1,7 +1,7 @@ # Generated by Django 2.2.24 on 2024-03-25 17:24 from django.db import migrations -from ishtar_common.utils import migrations_load_data +from ishtar_common.utils_migrations import migrations_load_data COLOR_WARNING = "\033[93m" COLOR_ENDC = "\033[0m" diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index b48b8f3a2..9aee643c4 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -63,7 +63,6 @@ from django.core.exceptions import SuspiciousOperation, ObjectDoesNotExist, \ ValidationError from django.core.files import File from django.core.files.storage import FileSystemStorage -from django.core.management import call_command from django.core.validators import EMPTY_VALUES, MaxValueValidator from django.db import models from django.db.models import Q @@ -1506,12 +1505,6 @@ def get_columns_from_class(cls, table_cols_attr="TABLE_COLS", dict_col_labels=Tr return table_cols, table_cols_label -def migrations_load_data(module_name, migration_filename): - json_path = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-2] + [ - module_name, "migrations", migration_filename]) - call_command("loaddata", json_path) - - def create_default_areas(models=None, verbose=False): # can be used on migrations if models are provided if not models: diff --git a/ishtar_common/utils_migrations.py b/ishtar_common/utils_migrations.py index 1aead83e8..72697f48b 100644 --- a/ishtar_common/utils_migrations.py +++ b/ishtar_common/utils_migrations.py @@ -6,9 +6,16 @@ import sys import uuid from django.core.files import File +from django.core.management import call_command from django.db import connection +def migrations_load_data(module_name, migration_filename): + json_path = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-2] + [ + module_name, "migrations", migration_filename]) + call_command("loaddata", json_path) + + def migrate_simple_image_to_m2m(base_model, image_model, rel_model, verbose=False): missing, moved = 0, 0 for item in base_model.objects.all(): |