summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-09-30 14:06:45 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-10-02 23:15:26 +0200
commit93ece4d67007e86066726d9b724a7fefa86db68f (patch)
tree33979ef9781993a9e983b0dcf4b6937fdead229a
parentcacd9f9389b4ccf136cf50191a36b7fbaf4bbded (diff)
downloadIshtar-93ece4d67007e86066726d9b724a7fefa86db68f.tar.bz2
Ishtar-93ece4d67007e86066726d9b724a7fefa86db68f.zip
🗃️ finds - specific tables for recommended treatments
-rw-r--r--archaeological_finds/admin.py5
-rw-r--r--archaeological_finds/forms.py21
-rw-r--r--archaeological_finds/migrations/0140_recommanded_treatments.py45
-rw-r--r--archaeological_finds/migrations/0141_data_migration_recommanded_treatments.json375
-rw-r--r--archaeological_finds/migrations/0141_data_migration_recommanded_treatments.py44
-rw-r--r--archaeological_finds/models.py2
-rw-r--r--archaeological_finds/models_finds.py34
-rw-r--r--archaeological_finds/templates/ishtar/sheet_find_treatments.html22
-rw-r--r--archaeological_finds/wizards.py2
-rw-r--r--archaeological_warehouse/forms.py7
-rw-r--r--archaeological_warehouse/models.py6
-rw-r--r--docs/ressources/db-archaeological_finds.svg2
-rw-r--r--ishtar_common/fixtures/initial_importtypes-fr.json16
-rw-r--r--ishtar_common/fixtures/initial_importtypes-tests-fr.json4
-rw-r--r--ishtar_common/views_item.py2
15 files changed, 548 insertions, 39 deletions
diff --git a/archaeological_finds/admin.py b/archaeological_finds/admin.py
index e056e2464..d6a711187 100644
--- a/archaeological_finds/admin.py
+++ b/archaeological_finds/admin.py
@@ -262,6 +262,11 @@ class SourceTypeAdmin(GeneralTypeAdmin):
LIST_DISPLAY = ["label", "txt_idx", "available", "parent", "order", "comment"]
+@admin.register(models.RecommendedTreatmentType, site=admin_site)
+class RecommendedTreatmentTypeAdmin(GeneralTypeAdmin):
+ LIST_DISPLAY = ["label", "txt_idx", "available", "parent", "order", "comment"]
+
+
general_models = [
models.AlterationCauseType, models.AlterationType, models.BatchType,
models.CollectionEntryModeType, models.IntegrityType, models.InventoryConformity,
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py
index def6c53b9..35c6ba6fb 100644
--- a/archaeological_finds/forms.py
+++ b/archaeological_finds/forms.py
@@ -930,6 +930,7 @@ class QAFindFormMulti(MuseumForm, QAForm):
"qa_cultural_attributions",
"qa_alterations",
"qa_alteration_causes",
+ "qa_recommended_treatments",
"qa_museum_collection_entry_mode",
"qa_museum_inventory_marking_presence",
"qa_museum_marking_type",
@@ -953,6 +954,7 @@ class QAFindFormMulti(MuseumForm, QAForm):
"qa_period": Period,
"qa_conservatory_states": models.ConservatoryState,
"qa_treatment_emergency": models.TreatmentEmergencyType,
+ "qa_recommended_treatments": models.RecommendedTreatmentType,
"qa_museum_collection_entry_mode": models.CollectionEntryModeType,
"qa_museum_owner_institution": Organization,
"qa_museum_assigned_institution": Organization,
@@ -1158,6 +1160,10 @@ class QAFindFormMulti(MuseumForm, QAForm):
qa_treatment_emergency = forms.ChoiceField(
label=_("Treatment emergency"), choices=[], required=False
)
+ qa_recommended_treatments = widgets.Select2MultipleField(
+ label=_("Recommended treatments"),
+ choices=[], required=False,
+ )
qa_integrities = widgets.Select2MultipleField(
label=_("Integrity"), required=False
)
@@ -1199,6 +1205,7 @@ class QAFindFormMulti(MuseumForm, QAForm):
FieldType("qa_cultural_attributions", CulturalAttributionType, is_multiple=True),
FieldType("qa_alterations", models.AlterationType, is_multiple=True),
FieldType("qa_alteration_causes", models.AlterationCauseType, is_multiple=True),
+ FieldType("qa_recommended_treatments", models.RecommendedTreatmentType, is_multiple=True),
FieldType("qa_remarkabilities", models.RemarkabilityType, is_multiple=True),
FieldType("qa_checked_type", models.CheckedType),
FieldType("qa_conservatory_states", models.ConservatoryState, is_multiple=True),
@@ -1498,7 +1505,7 @@ class PreservationForm(CustomForm, ManageOldType):
base_models = [
"alteration",
"alteration_cause",
- "preservation_to_consider",
+ "recommended_treatment",
"integritie",
"remarkabilitie",
"conservatory_state",
@@ -1508,7 +1515,7 @@ class PreservationForm(CustomForm, ManageOldType):
"alteration_cause": models.AlterationCauseType,
"treatment_emergency": models.TreatmentEmergencyType,
"conservatory_state": models.ConservatoryState,
- "preservation_to_consider": models.TreatmentType,
+ "recommended_treatment": models.RecommendedTreatmentType,
"remarkabilitie": models.RemarkabilityType,
"integritie": models.IntegrityType,
}
@@ -1542,7 +1549,7 @@ class PreservationForm(CustomForm, ManageOldType):
widget=widgets.Select2Multiple,
required=False,
)
- preservation_to_consider = forms.MultipleChoiceField(
+ recommended_treatment = forms.MultipleChoiceField(
label=_("Recommended treatments"),
choices=[],
widget=widgets.Select2Multiple,
@@ -1560,7 +1567,7 @@ class PreservationForm(CustomForm, ManageOldType):
TYPES = [
FieldType("treatment_emergency", models.TreatmentEmergencyType),
- FieldType("preservation_to_consider", models.TreatmentType, True),
+ FieldType("recommended_treatment", models.RecommendedTreatmentType, True),
FieldType("alteration", models.AlterationType, True),
FieldType("alteration_cause", models.AlterationCauseType, True),
FieldType("integritie", models.IntegrityType, is_multiple=True),
@@ -1671,7 +1678,7 @@ class FindSelect(MuseumForm, GeoItemSelect, PeriodSelect):
"conservatory_comment",
"alterations",
"alteration_causes",
- "preservation_to_considers",
+ "recommended_treatments",
"treatment_emergency",
),
),
@@ -1935,7 +1942,7 @@ class FindSelect(MuseumForm, GeoItemSelect, PeriodSelect):
conservatory_comment = forms.CharField(label=_("Conservatory comment"))
alterations = forms.ChoiceField(label=_("Alteration"), choices=[])
alteration_causes = forms.ChoiceField(label=_("Alteration cause"), choices=[])
- preservation_to_considers = forms.ChoiceField(
+ recommended_treatments = forms.ChoiceField(
choices=[], label=_("Recommended treatments")
)
treatment_emergency = forms.ChoiceField(choices=[], label=_("Treatment emergency"))
@@ -2010,7 +2017,7 @@ class FindSelect(MuseumForm, GeoItemSelect, PeriodSelect):
TYPES = PeriodSelect.TYPES + [
FieldType("conservatory_states", models.ConservatoryState),
FieldType("base_finds__batch", models.BatchType),
- FieldType("preservation_to_considers", models.TreatmentType),
+ FieldType("recommended_treatments", models.RecommendedTreatmentType),
FieldType("integrities", models.IntegrityType),
FieldType("remarkabilities", models.RemarkabilityType),
FieldType("base_finds__discovery_method", models.DiscoveryMethod),
diff --git a/archaeological_finds/migrations/0140_recommanded_treatments.py b/archaeological_finds/migrations/0140_recommanded_treatments.py
new file mode 100644
index 000000000..250c2bf74
--- /dev/null
+++ b/archaeological_finds/migrations/0140_recommanded_treatments.py
@@ -0,0 +1,45 @@
+# Generated by Django 2.2.24 on 2025-09-30 11:31
+
+import archaeological_finds.models_treatments
+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 = [
+ ('archaeological_finds', '0139_data_migration_owner_ownership'),
+ ]
+ operations = [
+ migrations.AlterField(
+ model_name='find',
+ name='preservation_to_considers',
+ field=models.ManyToManyField(blank=True, related_name='finds_old_recommended', to='archaeological_finds.TreatmentType', verbose_name='Recommended treatments'),
+ ),
+ migrations.CreateModel(
+ name='RecommendedTreatmentType',
+ 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_finds.RecommendedTreatmentType', verbose_name='Parent')),
+ ],
+ options={
+ 'verbose_name': 'Recommended treatment type',
+ 'verbose_name_plural': 'Recommended treatment types',
+ 'ordering': ('parent__order', 'parent__label', 'order', 'label'),
+ },
+ bases=(ishtar_common.models_common.Cached, models.Model),
+ ),
+ migrations.AddField(
+ model_name='find',
+ name='recommended_treatments',
+ field=models.ManyToManyField(blank=True, related_name='finds_recommended', to='archaeological_finds.RecommendedTreatmentType', verbose_name='Recommended treatments'),
+ ),
+ ]
diff --git a/archaeological_finds/migrations/0141_data_migration_recommanded_treatments.json b/archaeological_finds/migrations/0141_data_migration_recommanded_treatments.json
new file mode 100644
index 000000000..6739f836f
--- /dev/null
+++ b/archaeological_finds/migrations/0141_data_migration_recommanded_treatments.json
@@ -0,0 +1,375 @@
+[
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Tous mat\u00e9riaux",
+ "txt_idx": "tous-materiaux",
+ "comment": "",
+ "available": true,
+ "order": 10,
+ "parent": null
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Sp\u00e9cifique m\u00e9tal",
+ "txt_idx": "specifique-metal",
+ "comment": "",
+ "available": true,
+ "order": 20,
+ "parent": null
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Dessalement",
+ "txt_idx": "dessalement",
+ "comment": "",
+ "available": true,
+ "order": 10,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Collage",
+ "txt_idx": "collage",
+ "comment": "",
+ "available": true,
+ "order": 20,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Comblement",
+ "txt_idx": "comblement",
+ "comment": "",
+ "available": true,
+ "order": 30,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Consolidation ",
+ "txt_idx": "consolidation",
+ "comment": "",
+ "available": true,
+ "order": 40,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Remontage",
+ "txt_idx": "remontage",
+ "comment": "",
+ "available": true,
+ "order": 50,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "D\u00e9montage",
+ "txt_idx": "demontage",
+ "comment": "",
+ "available": true,
+ "order": 60,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "D\u00e9restauration",
+ "txt_idx": "derestauration",
+ "comment": "",
+ "available": true,
+ "order": 70,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "\u00c9limination des comblements",
+ "txt_idx": "limination-des-comblements",
+ "comment": "",
+ "available": true,
+ "order": 80,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "\u00c9limination des concr\u00e9tions",
+ "txt_idx": "limination-des-concretions",
+ "comment": "",
+ "available": true,
+ "order": 90,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "\u00c9limination des d\u00e9p\u00f4ts",
+ "txt_idx": "limination-des-depots",
+ "comment": "",
+ "available": true,
+ "order": 100,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Nettoyage",
+ "txt_idx": "nettoyage",
+ "comment": "",
+ "available": true,
+ "order": 110,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Reprise des anciens comblements",
+ "txt_idx": "reprise-des-anciens-comblements",
+ "comment": "",
+ "available": true,
+ "order": 120,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Mise en couleur",
+ "txt_idx": "mise-en-couleur",
+ "comment": "",
+ "available": true,
+ "order": 130,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "R\u00e9int\u00e9gration",
+ "txt_idx": "reintegration",
+ "comment": "",
+ "available": true,
+ "order": 140,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Marquage",
+ "txt_idx": "marquage",
+ "comment": "",
+ "available": true,
+ "order": 150,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Analyses",
+ "txt_idx": "analyses",
+ "comment": "",
+ "available": true,
+ "order": 160,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Radiographie X",
+ "txt_idx": "radiographie-x",
+ "comment": "",
+ "available": true,
+ "order": 170,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Conditionnement sp\u00e9cifique",
+ "txt_idx": "conditionnement-specifique",
+ "comment": "",
+ "available": true,
+ "order": 180,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Soclage",
+ "txt_idx": "soclage",
+ "comment": "",
+ "available": true,
+ "order": 190,
+ "parent": [
+ "tous-materiaux"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "D\u00e9chloruration",
+ "txt_idx": "dechloruration",
+ "comment": "",
+ "available": true,
+ "order": 10,
+ "parent": [
+ "specifique-metal"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "\u00c9limination des anciens rev\u00eatements",
+ "txt_idx": "limination-des-anciens-revetements",
+ "comment": "",
+ "available": true,
+ "order": 20,
+ "parent": [
+ "specifique-metal"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "\u00c9limination des produits de corrosion",
+ "txt_idx": "limination-des-produits-de-corrosion",
+ "comment": "",
+ "available": true,
+ "order": 30,
+ "parent": [
+ "specifique-metal"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Inhibition",
+ "txt_idx": "inhibition",
+ "comment": "",
+ "available": true,
+ "order": 40,
+ "parent": [
+ "specifique-metal"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Passivation",
+ "txt_idx": "passivation",
+ "comment": "",
+ "available": true,
+ "order": 50,
+ "parent": [
+ "specifique-metal"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Protection de surface",
+ "txt_idx": "protection-de-surface",
+ "comment": "",
+ "available": true,
+ "order": 60,
+ "parent": [
+ "specifique-metal"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Restitution de la lisibilit\u00e9 de surface",
+ "txt_idx": "restitution-de-la-lisibilite-de-surface",
+ "comment": "",
+ "available": true,
+ "order": 70,
+ "parent": [
+ "specifique-metal"
+ ]
+ }
+},
+{
+ "model": "archaeological_finds.recommendedtreatmenttype",
+ "fields": {
+ "label": "Stabilisation",
+ "txt_idx": "stabilisation",
+ "comment": "",
+ "available": true,
+ "order": 80,
+ "parent": [
+ "specifique-metal"
+ ]
+ }
+}
+]
diff --git a/archaeological_finds/migrations/0141_data_migration_recommanded_treatments.py b/archaeological_finds/migrations/0141_data_migration_recommanded_treatments.py
new file mode 100644
index 000000000..034c34a4c
--- /dev/null
+++ b/archaeological_finds/migrations/0141_data_migration_recommanded_treatments.py
@@ -0,0 +1,44 @@
+import os
+
+from django.db import migrations
+from django.core.management import call_command
+
+
+def load_data(apps, __):
+ migration = "0141_data_migration_recommanded_treatments.json"
+ json_path = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-1] + [migration])
+ call_command("loaddata", json_path)
+ Find = apps.get_model("archaeological_finds", "find")
+ if not hasattr(Find, "preservation_to_considers"):
+ return
+ q = Find.objects.filter(preservation_to_considers__isnull=False)
+ if not q.count():
+ return
+ TreatmentType = apps.get_model("archaeological_finds", "TreatmentType")
+ RecommendedTreatmentType = apps.get_model("archaeological_finds", "RecommendedTreatmentType")
+ parent = RecommendedTreatmentType.objects.create(
+ label="Anciennes recommandations",
+ txt_idx="anciennes-recommandations",
+ order=999,
+ )
+ reco = {}
+ for find in q.all():
+ for treatment_type in find.preservation_to_considers.all():
+ if treatment_type.txt_idx not in reco:
+ reco[treatment_type.txt_idx] = RecommendedTreatmentType.objects.create(
+ label=treatment_type.label,
+ txt_idx=treatment_type.txt_idx,
+ parent=parent
+ )
+ find.recommended_treatments.add(reco[treatment_type.txt_idx])
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_finds', '0140_recommanded_treatments'),
+ ]
+
+ operations = [
+ migrations.RunPython(load_data)
+ ]
diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py
index 7d5a9617d..05577c2ee 100644
--- a/archaeological_finds/models.py
+++ b/archaeological_finds/models.py
@@ -29,6 +29,7 @@ from archaeological_finds.models_finds import (
OwnershipStatus,
OwnerType,
Property,
+ RecommendedTreatmentType,
RemarkabilityType,
TechnicalAreaType,
TechnicalProcessType,
@@ -88,6 +89,7 @@ __all__ = [
"OriginalReproduction",
"Property",
"RemarkabilityType",
+ "RecommendedTreatmentType",
"TechnicalAreaType",
"TechnicalProcessType",
"Treatment",
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index 11a9eb66a..6104587c2 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -448,6 +448,23 @@ post_save.connect(post_save_cache, sender=CollectionEntryModeType)
post_delete.connect(post_save_cache, sender=CollectionEntryModeType)
+class RecommendedTreatmentType(OrderedHierarchicalType):
+ class Meta:
+ verbose_name = _("Recommended treatment type")
+ verbose_name_plural = _("Recommended treatment types")
+ ordering = (
+ "parent__order",
+ "parent__label",
+ "order",
+ "label",
+ )
+ ADMIN_SECTION = _("Finds")
+
+
+post_save.connect(post_save_cache, sender=RecommendedTreatmentType)
+post_delete.connect(post_save_cache, sender=RecommendedTreatmentType)
+
+
class InventoryMarkingPresence(OrderedType):
class Meta:
verbose_name = _("Presence of inventory marking type")
@@ -1308,7 +1325,7 @@ class Find(
("datings__period__label", _("Chronological period")),
("material_types__label", _("Material type")),
("object_types__label", _("Object type")),
- ("preservation_to_considers__label", _("Recommended treatments")),
+ ("recommended_treatments__label", _("Recommended treatments")),
("conservatory_states__label", _("Conservatory states")),
("integrities__label", _("Integrity")),
("remarkabilities__label", _("Remarkability")),
@@ -1496,9 +1513,9 @@ class Find(
pgettext_lazy("key for text search", "object-type"),
"object_types__label__iexact",
),
- "preservation_to_considers": SearchAltName(
+ "recommended_treatments": SearchAltName(
pgettext_lazy("key for text search", "recommended-treatments"),
- "preservation_to_considers__label__iexact",
+ "recommended_treatments__label__iexact",
),
"conservatory_states": SearchAltName(
pgettext_lazy("key for text search", "conservatory"),
@@ -2059,7 +2076,7 @@ class Find(
"museum_inventory_marking_presence",
"museum_marking_type",
"museum_former_collections",
- "preservation_to_considers",
+ "recommended_treatments",
"alterations",
"alteration_causes",
]
@@ -2074,12 +2091,11 @@ class Find(
"functional_areas",
"material_types",
"integrities",
- "preservation_to_considers",
+ "recommended_treatments",
"museum_former_collections",
"museum_inventory_marking_presence",
"museum_marking_type",
"object_types",
- "preservation_to_considers",
"remarkabilities",
"technical_areas",
"technical_processes",
@@ -2384,6 +2400,12 @@ class Find(
preservation_to_considers = models.ManyToManyField(
TreatmentType,
verbose_name=_("Recommended treatments"),
+ related_name="old_finds_recommended",
+ blank=True,
+ )
+ recommended_treatments = models.ManyToManyField(
+ RecommendedTreatmentType,
+ verbose_name=_("Recommended treatments"),
related_name="finds_recommended",
blank=True,
)
diff --git a/archaeological_finds/templates/ishtar/sheet_find_treatments.html b/archaeological_finds/templates/ishtar/sheet_find_treatments.html
index 265d6b45a..961134691 100644
--- a/archaeological_finds/templates/ishtar/sheet_find_treatments.html
+++ b/archaeological_finds/templates/ishtar/sheet_find_treatments.html
@@ -9,20 +9,20 @@
</div>
{% endif %}
{% endcomment %}
- {% if item.integrities_count or item.remarkabilities_count or item.conservatory_states_count or item.conservatory_comment or item.alterations.count or item.alteration_causes.count or item.preservation_to_considers.count or item.appraisal_date or item.treatment_emergency or item.insurance_value or item.estimated_value %}
+ {% if item.integrities_count or item.remarkabilities_count or item.conservatory_states_count or item.conservatory_comment or item.alterations.count or item.alteration_causes.count or item.recommended_treatments.count or item.appraisal_date or item.treatment_emergency or item.insurance_value or item.estimated_value %}
<h3>{% trans "Preservation" %}</h3>
<div class='row'>
- {% field_flex_multiple_obj "Integrity" item 'integrities' %}
- {% field_flex_multiple_obj "Remarkability" item 'remarkabilities' %}
+ {% field_flex_multiple_obj _("Integrity") item 'integrities' %}
+ {% field_flex_multiple_obj _("Remarkability") item 'remarkabilities' %}
{% field_flex_multiple_obj _("Conservatory states") item 'conservatory_states' %}
- {% field_flex_multiple_obj "Alteration" item 'alterations' %}
- {% field_flex_multiple_obj "Alteration cause" item 'alteration_causes' %}
- {% field_flex_multiple_obj "Recommended treatments" item 'preservation_to_considers' %}
- {% field_flex "Treatment emergency" item.treatment_emergency %}
- {% field_flex "Estimated value" item.estimated_value|default_if_none:''|intcomma '' ' '|add:CURRENCY %}
- {% field_flex "Insurance value" item.insurance_value|default_if_none:''|intcomma '' ' '|add:CURRENCY %}
- {% field_flex "Appraisal date" item.appraisal_date %}
- {% field_flex_full "Conservatory comment" item.conservatory_comment "<pre>" "</pre>" %}
+ {% field_flex_multiple_obj _("Alteration") item 'alterations' %}
+ {% field_flex_multiple_obj _("Alteration cause") item 'alteration_causes' %}
+ {% field_flex_multiple_obj _("Recommended treatments") item 'recommended_treatments' %}
+ {% field_flex _("Treatment emergency") item.treatment_emergency %}
+ {% field_flex _("Estimated value") item.estimated_value|default_if_none:''|intcomma '' ' '|add:CURRENCY %}
+ {% field_flex _("Insurance value") item.insurance_value|default_if_none:''|intcomma '' ' '|add:CURRENCY %}
+ {% field_flex _("Appraisal date") item.appraisal_date %}
+ {% field_flex_full _("Conservatory comment") item.conservatory_comment "<pre>" "</pre>" %}
</div>
{% endif %}
{% if item.container or item.container_ref %}
diff --git a/archaeological_finds/wizards.py b/archaeological_finds/wizards.py
index be189e3b1..34e9e9ca4 100644
--- a/archaeological_finds/wizards.py
+++ b/archaeological_finds/wizards.py
@@ -133,7 +133,7 @@ class FindDeletionWizard(MultipleDeletionWizard):
"description",
"conservatory_states",
"mark",
- "preservation_to_considers",
+ "recommended_treatments",
"integrities",
"remarkabilities",
"volume",
diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py
index 8a16a53ce..5b22362c4 100644
--- a/archaeological_warehouse/forms.py
+++ b/archaeological_warehouse/forms.py
@@ -49,6 +49,7 @@ from archaeological_finds.models import (
IntegrityType,
MaterialType,
ObjectType,
+ RecommendedTreatmentType,
RemarkabilityType,
TreatmentEmergencyType,
Treatment,
@@ -598,8 +599,8 @@ class ContainerSelect(DocumentItemSelect):
conservatory_state = forms.ChoiceField(label=_("Conservatory state"), choices=[])
alterations = forms.ChoiceField(label=_("Alteration"), choices=[])
alteration_causes = forms.ChoiceField(label=_("Alteration cause"), choices=[])
- preservation_to_considers = forms.ChoiceField(
- choices=[], label=_("Preservation type")
+ recommended_treatments = forms.ChoiceField(
+ choices=[], label=_("Recommended treatments")
)
treatment_emergency = forms.ChoiceField(choices=[], label=_("Treatment emergency"))
@@ -610,7 +611,7 @@ class ContainerSelect(DocumentItemSelect):
FieldType("conservatory_state", ConservatoryState),
FieldType("alterations", AlterationType),
FieldType("alteration_causes", AlterationCauseType),
- FieldType("preservation_to_considers", TreatmentType),
+ FieldType("recommended_treatments", RecommendedTreatmentType),
FieldType("treatment_emergency", TreatmentEmergencyType),
FieldType("container_type", models.ContainerType),
]
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py
index 8a52026a6..af55fd74b 100644
--- a/archaeological_warehouse/models.py
+++ b/archaeological_warehouse/models.py
@@ -1018,9 +1018,9 @@ class Container(
pgettext_lazy("key for text search", "object-type"),
"finds__object_types__label__iexact",
),
- "preservation_to_considers": SearchAltName(
- pgettext_lazy("key for text search", "preservation"),
- "finds__preservation_to_considers__label__iexact",
+ "recommended_treatments": SearchAltName(
+ pgettext_lazy("key for text search", "recommended-treatments"),
+ "finds__recommended_treatments__label__iexact",
),
"conservatory_state": SearchAltName(
pgettext_lazy("key for text search", "conservatory"),
diff --git a/docs/ressources/db-archaeological_finds.svg b/docs/ressources/db-archaeological_finds.svg
index 510a2731e..a1bb14305 100644
--- a/docs/ressources/db-archaeological_finds.svg
+++ b/docs/ressources/db-archaeological_finds.svg
@@ -1912,7 +1912,7 @@
<path fill="none" stroke="black" d="M2967.82,-3591.37C2419.65,-3535.96 681.64,-3329.14 352.59,-2907 345.45,-2897.84 344.84,-2706.65 352.59,-2698 376.9,-2670.85 491.07,-2706.96 515.59,-2680 540.41,-2652.7 500.99,-2043.49 525.59,-2016 568.01,-1968.59 623.86,-2044.2 667.59,-1998 671.81,-1993.54 728.42,-1121.74 730.59,-1116 770.89,-1009.55 1001.4,-815.49 1041.59,-709 1064.25,-648.98 1024.84,-623.31 1051.59,-565 1055.07,-557.42 1059.18,-550.03 1063.75,-542.86"/>
<ellipse fill="black" stroke="black" cx="2971.82" cy="-3591.78" rx="4" ry="4"/>
<ellipse fill="black" stroke="black" cx="1066.26" cy="-539.11" rx="4" ry="4"/>
-<text text-anchor="middle" x="821.59" y="-1487.1" font-family="Roboto" font-size="8.00"> preservation_to_considers (finds_recommended)</text>
+<text text-anchor="middle" x="821.59" y="-1487.1" font-family="Roboto" font-size="8.00"> recommended_treatments (finds_recommended)</text>
</g>
<!-- archaeological_finds_models_finds_IntegrityType -->
<g id="node19" class="node">
diff --git a/ishtar_common/fixtures/initial_importtypes-fr.json b/ishtar_common/fixtures/initial_importtypes-fr.json
index 670f1cf94..5f88400b0 100644
--- a/ishtar_common/fixtures/initial_importtypes-fr.json
+++ b/ishtar_common/fixtures/initial_importtypes-fr.json
@@ -2978,6 +2978,14 @@
"model": "ishtar_common.formatertype",
"fields": {
"formater_type": "TypeFormater",
+ "options": "archaeological_finds.models.RecommendedTreatmentType",
+ "many_split": "&"
+ }
+},
+{
+ "model": "ishtar_common.formatertype",
+ "fields": {
+ "formater_type": "TypeFormater",
"options": "archaeological_context_records.models.IdentificationType",
"many_split": "&"
}
@@ -5679,10 +5687,10 @@
"ishtar-finds",
15
],
- "target": "preservation_to_considers",
+ "target": "recommended_treatments",
"formater_type": [
"TypeFormater",
- "archaeological_finds.models.TreatmentType",
+ "archaeological_finds.models.RecommendedTreatmentType",
"&"
],
"force_new": false,
@@ -6933,10 +6941,10 @@
"inventory_combo",
25
],
- "target": "preservation_to_considers",
+ "target": "recommended_treatments",
"formater_type": [
"TypeFormater",
- "archaeological_finds.models.TreatmentType",
+ "archaeological_finds.models.RecommendedTreatmentType",
"&"
],
"force_new": false,
diff --git a/ishtar_common/fixtures/initial_importtypes-tests-fr.json b/ishtar_common/fixtures/initial_importtypes-tests-fr.json
index dfd31ee5b..e8bdb40f9 100644
--- a/ishtar_common/fixtures/initial_importtypes-tests-fr.json
+++ b/ishtar_common/fixtures/initial_importtypes-tests-fr.json
@@ -1539,10 +1539,10 @@
"mcc-mobilier",
18
],
- "target": "preservation_to_considers",
+ "target": "recommended_treatments",
"formater_type": [
"TypeFormater",
- "archaeological_finds.models.TreatmentType",
+ "archaeological_finds.models.RecommendedTreatmentType",
"&"
],
"force_new": false,
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py
index 4f81a2cf0..156c12184 100644
--- a/ishtar_common/views_item.py
+++ b/ishtar_common/views_item.py
@@ -126,7 +126,7 @@ LIST_FIELDS = { # key: hierarchic depth
"museum_marking_type": 0,
"museum_collection": 0,
"batch": 0,
- "preservation_to_considers": 0,
+ "recommended_treatments": HIERARCHIC_LEVELS,
"integrities": 0,
"remarkabilities": 0,
"checked_type": 0,