diff options
| -rw-r--r-- | archaeological_context_records/forms.py | 15 | ||||
| -rw-r--r-- | archaeological_context_records/migrations/0115_auto_20240213_1708.py (renamed from archaeological_context_records/migrations/0115_auto_20240213_1640.py) | 8 | ||||
| -rw-r--r-- | archaeological_context_records/models.py | 10 | ||||
| -rw-r--r-- | archaeological_context_records/templates/ishtar/sheet_contextrecord.html | 6 | ||||
| -rw-r--r-- | changelog/en/changelog_2022-06-15.md | 4 | ||||
| -rw-r--r-- | changelog/fr/changelog_2023-01-25.md | 4 | 
6 files changed, 40 insertions, 7 deletions
| diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py index 24a94f2f5..d0340cc78 100644 --- a/archaeological_context_records/forms.py +++ b/archaeological_context_records/forms.py @@ -167,6 +167,8 @@ class RecordSelect(GeoItemSelect, PeriodSelect):      unit = forms.ChoiceField(label=_("Unit type"), choices=[])      activity = forms.ChoiceField(label=_("Activity"), choices=[])      identification = forms.ChoiceField(label=_("Identification"), choices=[]) +    cultural_attributions = forms.ChoiceField( +        label=_("Cultural attribution"), choices=[], required=False)      parcel = forms.CharField(label=_("Parcel"))      has_finds = forms.NullBooleanField(label=_("Has finds"))      cr_relation_types = forms.ChoiceField( @@ -175,6 +177,7 @@ class RecordSelect(GeoItemSelect, PeriodSelect):      excavation_technics = forms.ChoiceField(label=_("Excavation techniques"), choices=[])      TYPES = PeriodSelect.TYPES + [ +        FieldType('cultural_attributions', models.CulturalAttributionType),          FieldType("unit", models.Unit),          FieldType("cr_relation_types", models.RelationType),          FieldType("ope_relation_types", OpeRelationType), @@ -496,14 +499,17 @@ RecordRelationsFormSet.form_admin_name = _("Context record - 050 - Relations")  RecordRelationsFormSet.form_slug = "contextrecord-050-recordrelations" -class RecordFormInterpretation(CustomForm, ManageOldType, forms.Form): +class RecordFormInterpretation(CustomForm, ManageOldType): +    HEADERS = {}      form_label = _("Interpretation")      form_admin_name = _("Context record - 040 - Interpretation")      form_slug = "contextrecord-040-interpretation" +    base_models = ["cultural_attribution"]      associated_models = {          "activity": models.ActivityType,          "identification": models.IdentificationType, +        'cultural_attribution': models.CulturalAttributionType,      }      interpretation = forms.CharField(          label=_("Interpretation"), widget=forms.Textarea, required=False @@ -512,10 +518,15 @@ class RecordFormInterpretation(CustomForm, ManageOldType, forms.Form):      identification = forms.ChoiceField(          label=_("Identification"), required=False, choices=[]      ) +    HEADERS['taq'] = FormHeader(_("Dating complements"))      taq = forms.IntegerField(label=_("TAQ"), required=False)      taq_estimated = forms.IntegerField(label=_("Estimated TAQ"), required=False)      tpq = forms.IntegerField(label=_("TPQ"), required=False)      tpq_estimated = forms.IntegerField(label=_("Estimated TPQ"), required=False) +    cultural_attribution = forms.MultipleChoiceField( +        label=_("Cultural attributions"), choices=[], +        widget=widgets.Select2Multiple, +        required=False)      datings_comment = forms.CharField(          label=_("Comments on dating"), required=False, widget=forms.Textarea      ) @@ -523,6 +534,8 @@ class RecordFormInterpretation(CustomForm, ManageOldType, forms.Form):      TYPES = [          FieldType("activity", models.ActivityType),          FieldType("identification", models.IdentificationType), +        FieldType('cultural_attribution', models.CulturalAttributionType, +                  True),      ] diff --git a/archaeological_context_records/migrations/0115_auto_20240213_1640.py b/archaeological_context_records/migrations/0115_auto_20240213_1708.py index 9780581cb..2ddcecafb 100644 --- a/archaeological_context_records/migrations/0115_auto_20240213_1640.py +++ b/archaeological_context_records/migrations/0115_auto_20240213_1708.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.24 on 2024-02-13 16:40 +# Generated by Django 2.2.24 on 2024-02-13 17:08  from django.db import migrations, models  import django.db.models.deletion @@ -7,11 +7,17 @@ import django.db.models.deletion  class Migration(migrations.Migration):      dependencies = [ +        ('archaeological_operations', '0114_auto_20231115_1616'),          ('archaeological_context_records', '0114_contextrecord_imports_updated'),      ]      operations = [          migrations.AddField( +            model_name='contextrecord', +            name='cultural_attributions', +            field=models.ManyToManyField(blank=True, to='archaeological_operations.CulturalAttributionType', verbose_name='Cultural attribution'), +        ), +        migrations.AddField(              model_name='identificationtype',              name='parent',              field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_context_records.IdentificationType', verbose_name='Parent'), diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 63f15eb86..832d496cd 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -70,10 +70,11 @@ from ishtar_common.models import (  from ishtar_common.models_common import GeoVectorData, HistoricalRecords,\      SerializeItem, geodata_attached_changed  from archaeological_operations.models import ( +    ArchaeologicalSite, +    CulturalAttributionType,      Operation,      Period,      Parcel, -    ArchaeologicalSite,  )  from ishtar_common.model_managers import UUIDModelManager @@ -615,6 +616,10 @@ class ContextRecord(              pgettext_lazy("key for text search", "excavation-technique"),              "excavation_technics__label__iexact",          ), +        "cultural_attributions": SearchAltName( +            pgettext_lazy("key for text search", "cultural-attribution"), +            "cultural_attributions__label__iexact", +        ),      }      ALT_NAMES.update(BaseHistorizedItem.ALT_NAMES)      ALT_NAMES.update(DocumentItem.ALT_NAMES) @@ -760,6 +765,9 @@ class ContextRecord(      )      filling = models.TextField(_("Filling"), blank=True, default="")      interpretation = models.TextField(_("Interpretation"), blank=True, default="") +    cultural_attributions = models.ManyToManyField( +        CulturalAttributionType, verbose_name=_("Cultural attribution"), blank=True +    )      taq = models.IntegerField(          _("TAQ"),          blank=True, diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html index 7fc1a03e7..6f3bafed7 100644 --- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -24,8 +24,9 @@  {% with display_documents=can_view_documents|and_:has_documents %}  {% with display_relations=item|safe_or:"right_relations.count|left_relations.count" %}  {% with has_image=item|safe_or:"images.count" %} +{% with has_cultural_attributions=item|safe_or:"cultural_attributions.count" %}  {% with display_interpretation=item.activity|or_:item.identification|or_:item.interpretation|or_:item.filling %} -{% with display_datations=item.taq|or_:item.taq_estimated|or_:item.tpq|or_:item.tpq_estimated %} +{% with display_datations=item.taq|or_:item.taq_estimated|or_:item.tpq|or_:item.tpq_estimated|or_:has_cultural_attributions %}  {% with can_view_finds=permission_view_own_find|or_:permission_view_find %}  {% with has_finds=item|safe_or:"base_finds.count" %}  {% with display_finds=has_finds|and_:can_view_finds %} @@ -197,6 +198,7 @@         role="tabpanel" aria-labelledby="{{window_id}}-datations-tab">          <h3>{% trans "Datations"%}</h3>          <div class='row'> +            {% field_flex_multiple_obj "Cultural attributions" item 'cultural_attributions' %}              {% field_flex "TAQ" item.taq %}              {% field_flex "Estimated TAQ" item.taq_estimated %}              {% field_flex "TPQ" item.tpq %} @@ -345,6 +347,6 @@      {% endif %}  </div> -{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} +{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %}  {% endblock %} diff --git a/changelog/en/changelog_2022-06-15.md b/changelog/en/changelog_2022-06-15.md index 0ec21b3f5..322df00fd 100644 --- a/changelog/en/changelog_2022-06-15.md +++ b/changelog/en/changelog_2022-06-15.md @@ -10,7 +10,9 @@ v4.0.XX - 2099-12-31    - get coordinates from geolocalisation  - geo sheet: display point buffer  - Container: new field Code (forms, sheet, search index and autocomplete) (#5704) -- Context record - identification type changes to hierarchical (#5739) +- Context record +  - identification type changes to hierarchical (#5739) +  - cultural attribution field (#5740)  #### Imports #####  - pre-import forms diff --git a/changelog/fr/changelog_2023-01-25.md b/changelog/fr/changelog_2023-01-25.md index 6889919d8..8289e0560 100644 --- a/changelog/fr/changelog_2023-01-25.md +++ b/changelog/fr/changelog_2023-01-25.md @@ -9,7 +9,9 @@ v4.0.XX - 2099-12-31    - obtention des coordonnées depuis la géolocalisation  - fiche géographique: affichage du tampon du point  - Contenant : nouveau champ Code (formulaires, fiche, index de recherche et autocomplétion) (#5704) -- Unité d'enregistrement - type d'identification passe en hiérarchique (#5739) +- Unité d'enregistrement +  - type d'identification passe en hiérarchique (#5739) +  - ajout de l'attribution culturelle (#5740)  #### Imports ##### | 
