diff options
| -rw-r--r-- | archaeological_finds/forms.py | 60 | ||||
| -rw-r--r-- | archaeological_finds/forms_treatments.py | 21 | ||||
| -rw-r--r-- | archaeological_finds/models_finds.py | 12 | ||||
| -rw-r--r-- | archaeological_finds/templates/ishtar/forms/qa_find_treatment.html | 2 | ||||
| -rw-r--r-- | archaeological_finds/templates/ishtar/sheet_find.html | 2 | ||||
| -rw-r--r-- | archaeological_warehouse/forms.py | 23 | ||||
| -rw-r--r-- | archaeological_warehouse/management/commands/migrate_to_new_container_management.py | 4 | ||||
| -rw-r--r-- | archaeological_warehouse/migrations/0110_auto_20210209_1610.py | 26 | ||||
| -rw-r--r-- | archaeological_warehouse/models.py | 18 | ||||
| -rw-r--r-- | archaeological_warehouse/templates/ishtar/sheet_container.html | 4 | ||||
| -rw-r--r-- | docs/fr/source/annexe-tech-3-variables-gen.rst | 6 | ||||
| -rw-r--r-- | scripts/migrate_from_v1_to_v2.sql | 2 | 
12 files changed, 116 insertions, 64 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index 4a93ffce4..58adb1de8 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -149,7 +149,7 @@ class BasicFindForm(CustomForm, ManageOldType):          'material_type_quality': models.MaterialTypeQualityType,          'object_type_quality': models.ObjectTypeQualityType,          'checked_type': models.CheckedType, -        'collection': Warehouse, +        #'collection': Warehouse,      }      field_order = [          'label', 'denomination', 'previous_id', 'museum_id', 'laboratory_id', @@ -175,12 +175,12 @@ class BasicFindForm(CustomForm, ManageOldType):      laboratory_id = forms.CharField(label=_(u"Laboratory ID"), required=False)      seal_number = forms.CharField(label=_(u"Seal number"), required=False)      mark = forms.CharField(label=_(u"Mark"), required=False) -    collection = forms.IntegerField( -        label=_("Collection (warehouse)"), -        widget=widgets.JQueryAutoComplete( -            reverse_lazy('autocomplete-warehouse'), -            associated_model=Warehouse, new=True), -        validators=[valid_id(Warehouse)], required=False) +    #collection = forms.IntegerField( +    #    label=_("Collection (warehouse)"), +    #    widget=widgets.JQueryAutoComplete( +    #        reverse_lazy('autocomplete-warehouse'), +    #        associated_model=Warehouse, new=True), +    #    validators=[valid_id(Warehouse)], required=False)      HEADERS['description'] = FormHeader(_(u"Description"))      description = forms.CharField(label=_(u"Description"), @@ -307,7 +307,7 @@ class FindForm(BasicFindForm):      field_order = [          'label', 'denomination', 'previous_id',          'get_first_base_find__excavation_id', 'museum_id', 'laboratory_id', -        'seal_number', 'mark', 'collection', 'description', +        'seal_number', 'mark', 'description',          'public_description', 'get_first_base_find__discovery_date',          'get_first_base_find__discovery_date_taq', 'get_first_base_find__batch',          'is_complete', 'material_type', 'material_type_quality', @@ -371,9 +371,9 @@ class FindForm(BasicFindForm):              'get_first_base_find__estimated_error_z',              'get_first_base_find__spatial_reference_system'          ], -        'warehouse': [ -            'collection' -        ] +        #'warehouse': [ +        #    'collection' +        #]      }      def clean(self): @@ -590,7 +590,7 @@ class QAFindFormMulti(QAForm):      REPLACE_FIELDS = [          'qa_denomination', 'qa_ue', 'qa_manufacturing_place', 'qa_checked_type',          'qa_check_date', 'qa_conservatory_state', 'qa_treatment_emergency', -        'qa_appraisal_date', 'qa_collection', +        'qa_appraisal_date', # 'qa_collection',      ]      HEADERS = { @@ -625,12 +625,12 @@ class QAFindFormMulti(QAForm):                                         required=False)      qa_seal_number = forms.CharField(label=_(u"Seal number"), required=False)      qa_mark = forms.CharField(label=_(u"Mark"), required=False) -    qa_collection = forms.IntegerField( -        label=_("Collection"), -        widget=widgets.JQueryAutoComplete( -            reverse_lazy('autocomplete-warehouse'), -            associated_model=Warehouse), -        validators=[valid_id(Warehouse)], required=False) +    #qa_collection = forms.IntegerField( +    #    label=_("Collection"), +    #    widget=widgets.JQueryAutoComplete( +    #        reverse_lazy('autocomplete-warehouse'), +    #        associated_model=Warehouse), +    #    validators=[valid_id(Warehouse)], required=False)      qa_description = forms.CharField(          label=_(u"Description"), widget=forms.Textarea, required=False) @@ -692,12 +692,12 @@ class QAFindFormMulti(QAForm):              return ""          return value -    def _get_qa_collection(self, value): -        try: -            value = Warehouse.objects.get(pk=value).name -        except Warehouse.DoesNotExist: -            return "" -        return value +    #def _get_qa_collection(self, value): +    #    try: +    #        value = Warehouse.objects.get(pk=value).name +    #    except Warehouse.DoesNotExist: +    #        return "" +    #    return value      def _set_qa_ue(self, item, user):          ue = self.cleaned_data['qa_ue'] @@ -1267,12 +1267,12 @@ class FindSelect(DocumentItemSelect, PeriodSelect):  class FindSelectWarehouseModule(FindSelect): -    collection = forms.IntegerField( -        label=_("Collection (warehouse)"), -        widget=widgets.JQueryAutoComplete( -            reverse_lazy('autocomplete-warehouse'), -            associated_model=Warehouse), -        validators=[valid_id(Warehouse)]) +    #collection = forms.IntegerField( +    #    label=_("Collection (warehouse)"), +    #    widget=widgets.JQueryAutoComplete( +    #        reverse_lazy('autocomplete-warehouse'), +    #        associated_model=Warehouse), +    #    validators=[valid_id(Warehouse)])      container = forms.IntegerField(          label=_("Current container"),          widget=widgets.JQueryAutoComplete( diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py index ad4966e51..ac4420ce8 100644 --- a/archaeological_finds/forms_treatments.py +++ b/archaeological_finds/forms_treatments.py @@ -412,10 +412,11 @@ class QAFindTreatmentForm(IshtarForm):              ('current', _("the current container")),          )      ) -    collection = forms.BooleanField( -        label=_("Associate to the collection of the container"), required=False, -        widget=widgets.CheckboxInput -    ) +    #collection = forms.BooleanField( +    #    label=_("Associate to the collection of the container"), +    #    required=False, +    #    widget=widgets.CheckboxInput +    #)      create_treatment = forms.BooleanField(          label=_("Create a treatment"), required=False,          widget=widgets.CheckboxInput @@ -531,14 +532,14 @@ class QAFindTreatmentForm(IshtarForm):              container_attrs.append('container_ref')          if container_to_change in ('current', 'current-and-reference'):              container_attrs.append('container') -        collection = None -        if self.cleaned_data.get("collection"): -            collection = container.location_id +        #collection = None +        #if self.cleaned_data.get("collection"): +        #    collection = container.location_id          for find in items:              changed = False -            if collection and find.collection_id != collection: -                find.collection_id = collection -                changed = True +            #if collection and find.collection_id != collection: +            #    find.collection_id = collection +            #    changed = True              for container_attr in container_attrs:                  if getattr(find, container_attr) == container:                      continue diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 9394a41d0..1bfe56708 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1166,10 +1166,10 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem,              SearchAltName(                  pgettext_lazy("key for text search", "previous-id"),                  'previous_id__iexact'), -        'collection': -            SearchAltName( -                pgettext_lazy("key for text search", "collection"), -                'collection__name__iexact'), +        #'collection': +        #    SearchAltName( +        #        pgettext_lazy("key for text search", "collection"), +        #        'collection__name__iexact'),          'seal_number':              SearchAltName(                  pgettext_lazy("key for text search", "seal-number"), @@ -1652,7 +1652,9 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem,                                          null=True)      collection = models.ForeignKey(          "archaeological_warehouse.Warehouse", verbose_name=_("Collection"), -        blank=True, null=True, related_name='finds', on_delete=models.SET_NULL) +        blank=True, null=True, related_name='finds', on_delete=models.SET_NULL, +        help_text=_("Do not use - need evolutions"), +    )      # preservation module      conservatory_state = models.ForeignKey( diff --git a/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html b/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html index e8d00cb33..8a6367c7e 100644 --- a/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html +++ b/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html @@ -30,11 +30,13 @@          {% endwith %}          {% endwith %}      </div> +    {% comment %}      <div class="form-row">          {{ form.collection }} <label for="{{form.collection.auto_id}}">          {% trans "Associate to the collection of the container" %}          </label>      </div> +    {% endcomment %}      <div class="form-row">          {{ form.create_treatment }} <label for="{{form.create_treatment.auto_id}}"> diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html index 76dc14cd8..2a1cf595a 100644 --- a/archaeological_finds/templates/ishtar/sheet_find.html +++ b/archaeological_finds/templates/ishtar/sheet_find.html @@ -256,11 +256,13 @@    {% if display_warehouse_treatments %}    <div class="tab-pane fade" id="{{window_id}}-warehouse"         role="tabpanel" aria-labelledby="{{window_id}}-warehouse-tab"> +      {% comment %}        {% if item.collection %}        <div class='row'>            {% field_flex_detail "Collection" item.collection "large" %}        </div>        {% endif %} +      {% endcomment %}        {% if item.container or item.container_ref %}        <h3>{% trans "Warehouse - container" %}</h3>        <div class='row'> diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index c5720390a..3b10fb608 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -265,7 +265,7 @@ class ContainerForm(CustomForm, ManageOldType, forms.Form):      extra_form_modals = ["warehouse", "organization", "person", "container"]      associated_models = {'container_type': models.ContainerType,                           'location': models.Warehouse, -                         'collection': models.Warehouse, +                         'responsibility': models.Warehouse,                           'parent': models.Container}      reference = forms.CharField(label=_("Ref."), max_length=200)      old_reference = forms.CharField(label=_("Old reference"), required=False, @@ -286,8 +286,8 @@ class ContainerForm(CustomForm, ManageOldType, forms.Form):          validators=[valid_id(models.Container)],          required=False      ) -    collection = forms.IntegerField( -        label=_("Collection"), +    responsibility = forms.IntegerField( +        label=_("Responsibility"),          widget=widgets.JQueryAutoComplete(              reverse_lazy('autocomplete-warehouse'),              associated_model=models.Warehouse, new=True), @@ -415,6 +415,8 @@ class ContainerSelect(DocumentItemSelect):              'archaeological-warehouse', 'container'          ))      location_name = get_warehouse_field(label=_("Warehouse")) +    responsibility_name = get_warehouse_field( +        label=_("Warehouse (responsibility)"))      container_type = forms.ChoiceField(label=_("Container type"), choices=[])      reference = forms.CharField(label=_("Ref."))      old_reference = forms.CharField(label=_("Old reference")) @@ -597,7 +599,8 @@ class QAContainerFormMulti(QAForm):      REPLACE_FIELDS = [          "qaparent",          "qacontainer_type", -        "qalocation" +        "qalocation", +        "qaresponsibility"      ]      HEADERS = { @@ -613,6 +616,12 @@ class QAContainerFormMulti(QAForm):              reverse_lazy('autocomplete-warehouse'),              associated_model=models.Warehouse),          validators=[valid_id(models.Warehouse)], required=False) +    qaresponsibility = forms.IntegerField( +        label=_("Responsibility"), +        widget=widgets.JQueryAutoComplete( +            reverse_lazy('autocomplete-warehouse'), +            associated_model=models.Warehouse), +        validators=[valid_id(models.Warehouse)], required=False)      qaparent = forms.IntegerField(          label=_("Parent"),          widget=widgets.JQueryAutoComplete( @@ -638,6 +647,12 @@ class QAContainerFormMulti(QAForm):          except models.Warehouse.DoesNotExist:              return "" +    def _get_qaresponsibility(self, value): +        try: +            return models.Warehouse.objects.get(pk=value).name +        except models.Warehouse.DoesNotExist: +            return "" +      def _get_qaparent(self, value):          try:              return models.Container.objects.get(pk=value).cached_label diff --git a/archaeological_warehouse/management/commands/migrate_to_new_container_management.py b/archaeological_warehouse/management/commands/migrate_to_new_container_management.py index 38cabd842..abf207023 100644 --- a/archaeological_warehouse/management/commands/migrate_to_new_container_management.py +++ b/archaeological_warehouse/management/commands/migrate_to_new_container_management.py @@ -89,8 +89,8 @@ class Command(BaseCommand):                          potential_duplicate[container.responsible_id][                              ref].append(division.reference.strip())                  parent = new_container -            if container.collection_id != container.responsible_id: -                container.collection_id = container.responsible_id +            if container.responsibility_id != container.responsible_id: +                container.responsibility_id = container.responsible_id                  container.save()              if parent:                  q = models.Container.objects.filter( diff --git a/archaeological_warehouse/migrations/0110_auto_20210209_1610.py b/archaeological_warehouse/migrations/0110_auto_20210209_1610.py new file mode 100644 index 000000000..e3a60ec86 --- /dev/null +++ b/archaeological_warehouse/migrations/0110_auto_20210209_1610.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.27 on 2021-02-09 16:10 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('archaeological_warehouse', '0109_auto_20210202_1844'), +    ] + +    operations = [ +        migrations.RenameField( +            model_name='container', +            old_name='collection', +            new_name='responsibility', +        ), +        migrations.AlterField( +            model_name='container', +            name='responsibility', +            field=models.ForeignKey(blank=True, help_text='Warehouse that own the container', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='responsibilities', to='archaeological_warehouse.Warehouse', verbose_name='Responsibility'), +        ), +    ] diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 7112e6830..71c6a8145 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -685,6 +685,10 @@ class Container(DocumentItem, Merge, LightHistorizedItem,              pgettext_lazy("key for text search", "location"),              'location__name__iexact'          ), +        'responsibility_name': SearchAltName( +            pgettext_lazy("key for text search", "responsibility"), +            'responsibility__name__iexact' +        ),          'container_type': SearchAltName(              pgettext_lazy("key for text search", "type"),              'container_type__label__iexact' @@ -854,9 +858,9 @@ class Container(DocumentItem, Merge, LightHistorizedItem,          related_name='owned_containers', blank=True, null=True,          help_text=_("Deprecated - do not use")      ) -    collection = models.ForeignKey( -        Warehouse, verbose_name=_("Collection"), -        related_name='collections', blank=True, null=True, +    responsibility = models.ForeignKey( +        Warehouse, verbose_name=_("Responsibility"), +        related_name='responsibilities', blank=True, null=True,          help_text=_("Warehouse that own the container")      )      container_type = models.ForeignKey(ContainerType, @@ -1364,11 +1368,11 @@ class Container(DocumentItem, Merge, LightHistorizedItem,      def pre_save(self):          if self.parent == self:              self.parent = None -        if not self.collection_id and not self.collection: +        if not self.responsibility_id and not self.responsibility:              if self.location_id: -                self.collection_id = self.location_id -            else: -                self.collection = self.location +                self.responsibility_id = self.location_id +            if self.location: +                self.responsibility = self.location          if self.container_type.stationary:              return          q = Container.objects.filter(index=self.index, location=self.location) diff --git a/archaeological_warehouse/templates/ishtar/sheet_container.html b/archaeological_warehouse/templates/ishtar/sheet_container.html index 7ffafa7f6..98b640936 100644 --- a/archaeological_warehouse/templates/ishtar/sheet_container.html +++ b/archaeological_warehouse/templates/ishtar/sheet_container.html @@ -106,8 +106,8 @@                      <dt>{% trans "Number of owned finds" %}</dt>                      <dd>{{item.number_of_finds}}</dd>                  </dl> -                {% if item.collection != item.location %} -                {% field_flex_detail "Collection" item.collection %} +                {% if item.responsibility != item.location %} +                {% field_flex_detail "Responsibility" item.responsibility %}                  {% endif %}                  {% include "ishtar/blocks/sheet_creation_section.html" %}                  {% field_flex "Old reference" item.old_reference %} diff --git a/docs/fr/source/annexe-tech-3-variables-gen.rst b/docs/fr/source/annexe-tech-3-variables-gen.rst index 5dc5a9d75..7e4a85753 100644 --- a/docs/fr/source/annexe-tech-3-variables-gen.rst +++ b/docs/fr/source/annexe-tech-3-variables-gen.rst @@ -7,7 +7,7 @@ Annexe technique 3 - Variables  ==============================  :Auteurs: Étienne Loks, Ishtar team -:Date: 2021-01-11 +:Date: 2021-02-09  :Copyright: CC-BY 3.0  :Ishtar Version: v3.1.0 @@ -554,7 +554,7 @@ Chaque élément mobilier dispose du champ `data__` ainsi que des champs suivant  - **clutter_height** : *Nombre à virgule* - Encombrement - hauteur (cm)  - **clutter_long_side** : *Nombre à virgule* - Encombrement - grand côté (cm)  - **clutter_short_side** : *Nombre à virgule* - Encombrement - petit côté (cm) -- **collection__** : *→ Lieu de conservation* - Collection  +- **collection__** : *→ Lieu de conservation* - Collection  - Do not use - need evolutions   - **comment** : *Texte* - Commentaire  - **communicabilities__** : *→ Type de communicabilité* (**label** Dénomination, **txt_idx** Identifiant textuel) - Communicabilité   - **complete_identifier** : *Texte* - Complete identifier @@ -713,6 +713,7 @@ Chaque dépot dispose des :ref:`champs adresse <valeurs-champs-adresse>`, des :r  - **person_in_charge__** : *→ Personne* - Personne responsable   - **precise_town__** : *→ Commune* (**name** Nom, **numero_insee** Code commune (numéro INSEE), **cached_label** Nom en cache) - Commune (précis)   - **qrcode** : *Image (255)* - qrcode +- **responsibilities__** : *→ Contenants (responsibility)*  - **spatial_reference_system__** : *→ Système de référence spatiale* (**label** Dénomination, **txt_idx** Identifiant textuel, **srid** SRID, **auth_name** Registre) - Système de référence spatiale   - **treatment__** : *→ Traitements (localisation)*  - **warehouse_type__** : *→ Type de lieu de conservation* (**label** Dénomination, **txt_idx** Identifiant textuel) - Type de lieu de conservation  @@ -746,6 +747,7 @@ Chaque contenant dispose des :ref:`champs géographiques <valeurs-champs-geo>`,  - **parent__** : *→ Contenant* - Parent container   - **qrcode** : *Image (255)* - qrcode  - **reference** : *Texte* - Réf. du contenant +- **responsibility__** : *→ Lieu de conservation* - Responsibility  - Warehouse that own the container   - **responsible__** : *→ Lieu de conservation* - Lieu de conservation responsable  - Deprecated - do not use   - **spatial_reference_system__** : *→ Système de référence spatiale* (**label** Dénomination, **txt_idx** Identifiant textuel, **srid** SRID, **auth_name** Registre) - Système de référence spatiale   - **treatment__** : *→ Traitements (contenant)* diff --git a/scripts/migrate_from_v1_to_v2.sql b/scripts/migrate_from_v1_to_v2.sql deleted file mode 100644 index 7d40e5c54..000000000 --- a/scripts/migrate_from_v1_to_v2.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE auth_user ALTER last_login DROP NOT NULL; -ALTER TABLE django_content_type DROP COLUMN name;  | 
