diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-10-10 18:44:34 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-10-10 18:44:34 +0200 | 
| commit | 322418dc502f2157e36f195b6d757f2aa92b32b0 (patch) | |
| tree | daf9c406be228607487439908721cee459e9ef03 | |
| parent | c1ac27b407f11bae18a8180e82638562e99f913b (diff) | |
| parent | 929a7a1512d93c4548fbe6d5aa029ab366c171be (diff) | |
| download | Ishtar-322418dc502f2157e36f195b6d757f2aa92b32b0.tar.bz2 Ishtar-322418dc502f2157e36f195b6d757f2aa92b32b0.zip | |
Merge branch 'develop'
| -rw-r--r-- | Makefile.example | 1 | ||||
| -rw-r--r-- | archaeological_finds/admin.py | 2 | ||||
| -rw-r--r-- | archaeological_finds/data_importer.py | 2 | ||||
| -rw-r--r-- | archaeological_finds/fixtures/initial_data-fr.json | 45 | ||||
| -rw-r--r-- | archaeological_finds/forms.py | 10 | ||||
| -rw-r--r-- | archaeological_finds/migrations/0009_auto_20171010_1644.py | 23 | ||||
| -rw-r--r-- | archaeological_finds/models.py | 8 | ||||
| -rw-r--r-- | archaeological_finds/models_finds.py | 33 | ||||
| -rw-r--r-- | archaeological_finds/models_treatments.py | 26 | ||||
| -rw-r--r-- | archaeological_finds/templates/ishtar/sheet_find.html | 3 | ||||
| -rw-r--r-- | archaeological_finds/urls.py | 4 | ||||
| -rw-r--r-- | archaeological_finds/views.py | 3 | ||||
| -rw-r--r-- | archaeological_warehouse/models.py | 3 | ||||
| -rw-r--r-- | fixtures/initial_data-auth-fr.json | 33 | ||||
| -rw-r--r-- | ishtar_common/fixtures/initial_importtypes-fr.json | 6 | ||||
| -rw-r--r-- | ishtar_common/models_imports.py | 2 | 
16 files changed, 70 insertions, 134 deletions
| diff --git a/Makefile.example b/Makefile.example index 84325806b..abb4eec77 100644 --- a/Makefile.example +++ b/Makefile.example @@ -191,7 +191,6 @@ fixtures_finds:  							archaeological_finds.treatmentstate \  							archaeological_finds.conservatorystate \  							archaeological_finds.remarkabilitytype \ -							archaeological_finds.preservationtype \  							archaeological_finds.objecttype \  							archaeological_finds.integritytype \  							archaeological_finds.batchtype \ diff --git a/archaeological_finds/admin.py b/archaeological_finds/admin.py index 6e354211f..b8ed15865 100644 --- a/archaeological_finds/admin.py +++ b/archaeological_finds/admin.py @@ -182,7 +182,7 @@ admin_site.register(models.TreatmentType, TreatmentTypeAdmin)  general_models = [      models.ConservatoryState, models.RemarkabilityType, -    models.PreservationType, models.IntegrityType, +    models.IntegrityType,      models.TreatmentFileType, models.TreatmentState,      models.BatchType, models.AlterationCauseType, models.AlterationType,      models.TreatmentEmergencyType diff --git a/archaeological_finds/data_importer.py b/archaeological_finds/data_importer.py index 57b4e3927..e0c18d1bf 100644 --- a/archaeological_finds/data_importer.py +++ b/archaeological_finds/data_importer.py @@ -74,7 +74,7 @@ class FindsImporterBibracte(Importer):                         TypeFormater(models.ConservatoryState), required=False),          # preservation_to_consider          ImportFormater('find__preservation_to_considers', -                       TypeFormater(models.PreservationType), required=False), +                       TypeFormater(models.TreatmentType), required=False),          # comment          ImportFormater('comment', UnicodeFormater(1000), required=False),          # lien vers plusieurs chrono (voir gestion actuelle chrono) diff --git a/archaeological_finds/fixtures/initial_data-fr.json b/archaeological_finds/fixtures/initial_data-fr.json index 0c835841e..a346da9ab 100644 --- a/archaeological_finds/fixtures/initial_data-fr.json +++ b/archaeological_finds/fixtures/initial_data-fr.json @@ -993,51 +993,6 @@      }  },  { -    "model": "archaeological_finds.preservationtype", -    "fields": { -        "label": "Ind\u00e9termin\u00e9", -        "txt_idx": "unknown", -        "comment": "", -        "available": true -    } -}, -{ -    "model": "archaeological_finds.preservationtype", -    "fields": { -        "label": "\u00c0 reconditionner", -        "txt_idx": "recond", -        "comment": "", -        "available": true -    } -}, -{ -    "model": "archaeological_finds.preservationtype", -    "fields": { -        "label": "\u00c0 stabiliser", -        "txt_idx": "to_stab", -        "comment": "", -        "available": true -    } -}, -{ -    "model": "archaeological_finds.preservationtype", -    "fields": { -        "label": "\u00c0 restaurer", -        "txt_idx": "to_restaur", -        "comment": "", -        "available": true -    } -}, -{ -    "model": "archaeological_finds.preservationtype", -    "fields": { -        "label": "\u00c0 laver", -        "txt_idx": "to_wash", -        "comment": "", -        "available": true -    } -}, -{      "model": "archaeological_finds.objecttype",      "fields": {          "label": "ancre", diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index 39d97c927..aa0ae4621 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -293,7 +293,7 @@ class PreservationForm(ManageOldType, forms.Form):                           'alteration_cause': models.AlterationCauseType,                           'treatment_emergency': models.TreatmentEmergencyType,                           'conservatory_state': models.ConservatoryState, -                         'preservation_to_consider': models.PreservationType, +                         'preservation_to_consider': models.TreatmentType,                           }      conservatory_state = forms.ChoiceField(label=_(u"Conservatory state"),                                             choices=[], required=False) @@ -304,7 +304,7 @@ class PreservationForm(ManageOldType, forms.Form):          label=_(u"Alteration cause"), choices=[],          widget=widgets.Select2Multiple, required=False)      preservation_to_consider = forms.MultipleChoiceField( -        label=_(u"Preservation type"), choices=[], +        label=_(u"Recommended treatments"), choices=[],          widget=widgets.Select2Multiple, required=False)      treatment_emergency = forms.ChoiceField(label=_("Treatment emergency"),                                              choices=[], required=False) @@ -318,7 +318,7 @@ class PreservationForm(ManageOldType, forms.Form):      TYPES = [          ('conservatory_state', models.ConservatoryState, False),          ('treatment_emergency', models.TreatmentEmergencyType, False), -        ('preservation_to_consider', models.PreservationType, True), +        ('preservation_to_consider', models.TreatmentType, True),          ('alteration', models.AlterationType, True),          ('alteration_cause', models.AlterationCauseType, True),      ] @@ -437,9 +437,9 @@ class FindSelect(TableSelect):          self.fields['checked'].choices = \              [('', '--')] + list(models.CHECK_CHOICES)          self.fields['preservation_to_considers'].choices = \ -            models.PreservationType.get_types() +            models.TreatmentType.get_types()          self.fields['preservation_to_considers'].help_text = \ -            models.PreservationType.get_help() +            models.TreatmentType.get_help()          self.fields['integrities'].choices = \              models.IntegrityType.get_types()          self.fields['integrities'].help_text = \ diff --git a/archaeological_finds/migrations/0009_auto_20171010_1644.py b/archaeological_finds/migrations/0009_auto_20171010_1644.py new file mode 100644 index 000000000..882e9ae86 --- /dev/null +++ b/archaeological_finds/migrations/0009_auto_20171010_1644.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2017-10-10 16:44 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('archaeological_finds', '0008_auto_20171004_1327'), +    ] + +    operations = [ +        migrations.DeleteModel( +            name='PreservationType', +        ), +        migrations.AlterField( +            model_name='find', +            name='preservation_to_considers', +            field=models.ManyToManyField(blank=True, related_name='finds_recommended', to='archaeological_finds.TreatmentType', verbose_name='Recommended treatments'), +        ), +    ] diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py index ab3686f08..2f7c547b8 100644 --- a/archaeological_finds/models.py +++ b/archaeological_finds/models.py @@ -1,14 +1,14 @@  from archaeological_finds.models_finds import MaterialType, ConservatoryState,\ -    PreservationType, IntegrityType, RemarkabilityType, ObjectType, BaseFind, \ +    IntegrityType, RemarkabilityType, ObjectType, BaseFind, \      FindBasket, Find, FindSource, Property, CHECK_CHOICES, BatchType, \      BFBulkView, FBulkView, FirstBaseFindView, AlterationType, \ -    AlterationCauseType, TreatmentEmergencyType -from archaeological_finds.models_treatments import TreatmentType, Treatment, \ +    AlterationCauseType, TreatmentEmergencyType, TreatmentType +from archaeological_finds.models_treatments import Treatment, \      AbsFindTreatments, FindUpstreamTreatments, FindDownstreamTreatments, \      FindTreatments, TreatmentSource, TreatmentFile, TreatmentFileType, \      TreatmentFileSource, TreatmentState -__all__ = ['MaterialType', 'ConservatoryState', 'PreservationType', +__all__ = ['MaterialType', 'ConservatoryState',             'IntegrityType', 'RemarkabilityType', 'ObjectType',             'BaseFind', 'FindBasket', 'Find', 'FindSource', 'Property',             'BFBulkView', 'FBulkView', 'FirstBaseFindView', 'AlterationType', diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 3d379d2a7..e58d14f7e 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -69,15 +69,28 @@ post_save.connect(post_save_cache, sender=ConservatoryState)  post_delete.connect(post_save_cache, sender=ConservatoryState) -class PreservationType(GeneralType): +class TreatmentType(GeneralType): +    order = models.IntegerField(_(u"Order"), default=10) +    parent = models.ForeignKey("TreatmentType", verbose_name=_(u"Parent type"), +                               blank=True, null=True) +    virtual = models.BooleanField(_(u"Virtual")) +    upstream_is_many = models.BooleanField( +        _(u"Upstream is many"), default=False, +        help_text=_( +            u"Check this if for this treatment from many finds you'll get " +            u"one.")) +    downstream_is_many = models.BooleanField( +        _(u"Downstream is many"), default=False, +        help_text=_( +            u"Check this if for this treatment from one find you'll get " +            u"many.")) +      class Meta: -        verbose_name = _(u"Preservation type") -        verbose_name_plural = _(u"Preservation types") +        verbose_name = _(u"Treatment type") +        verbose_name_plural = _(u"Treatment types")          ordering = ('label',) - - -post_save.connect(post_save_cache, sender=PreservationType) -post_delete.connect(post_save_cache, sender=PreservationType) +post_save.connect(post_save_cache, sender=TreatmentType) +post_delete.connect(post_save_cache, sender=TreatmentType)  class IntegrityType(GeneralType): @@ -544,6 +557,7 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, ImageModel,          'previous_id', 'label', 'material_types__label',          'datings__period__label', 'find_number', 'object_types__label',          'container__cached_label', +        'container__cahed_location',          'description',          'base_finds__context_record__parcel__town',          'base_finds__context_record__parcel', ] @@ -714,8 +728,9 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, ImageModel,      conservatory_comment = models.TextField(_(u"Conservatory comment"),                                              blank=True, null=True)      preservation_to_considers = models.ManyToManyField( -        PreservationType, verbose_name=_(u"Type of preservation to consider"), -        related_name='finds', blank=True) +        TreatmentType, +        verbose_name=_(u"Recommended treatments"), +        related_name='finds_recommended', blank=True)      alterations = models.ManyToManyField(          AlterationType, verbose_name=_(u"Alteration"), blank=True,          related_name='finds' diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index 866e218aa..0ffcd87fa 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -32,34 +32,10 @@ from ishtar_common.models import GeneralType, ImageModel, BaseHistorizedItem, \      OwnPerms, HistoricalRecords, Person, Organization, Source, \      ValueGetter, post_save_cache, ShortMenuItem, DashboardFormItem  from archaeological_warehouse.models import Warehouse, Container -from archaeological_finds.models_finds import Find, FindBasket +from archaeological_finds.models_finds import Find, FindBasket, TreatmentType  from archaeological_operations.models import ClosedItem, Operation -class TreatmentType(GeneralType): -    order = models.IntegerField(_(u"Order"), default=10) -    parent = models.ForeignKey("TreatmentType", verbose_name=_(u"Parent type"), -                               blank=True, null=True) -    virtual = models.BooleanField(_(u"Virtual")) -    upstream_is_many = models.BooleanField( -        _(u"Upstream is many"), default=False, -        help_text=_( -            u"Check this if for this treatment from many finds you'll get " -            u"one.")) -    downstream_is_many = models.BooleanField( -        _(u"Downstream is many"), default=False, -        help_text=_( -            u"Check this if for this treatment from one find you'll get " -            u"many.")) - -    class Meta: -        verbose_name = _(u"Treatment type") -        verbose_name_plural = _(u"Treatment types") -        ordering = ('label',) -post_save.connect(post_save_cache, sender=TreatmentType) -post_delete.connect(post_save_cache, sender=TreatmentType) - -  class TreatmentState(GeneralType):      class Meta:          verbose_name = _(u"Treatment state type") diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html index 0657b2741..efd38e406 100644 --- a/archaeological_finds/templates/ishtar/sheet_find.html +++ b/archaeological_finds/templates/ishtar/sheet_find.html @@ -64,7 +64,7 @@    {% field_li "Conservatory state" item.conservatory_state %}    {% field_li_multiple "Alteration" item.alterations %}    {% field_li_multiple "Alteration cause" item.alteration_causes %} -  {% field_li_multiple "Type of preservation to consider" item.preservation_to_considers %} +  {% field_li_multiple "Recommended treatments" item.preservation_to_considers %}    {% field_li "Treatment emergency" item.treatment_emergency %}    {% field_li "Insurance value" item.insurance_value|default_if_none:''|intcomma '' ' '|add:CURRENCY %}    {% field_li "Appraisal date" item.appraisal_date %} @@ -75,6 +75,7 @@  {% if item.container %}  <h3>{% trans "Warehouse"%}</h3>  {% field_detail "Container" item.container %} +{% field "Container ID" item.container.cached_location %}  {% field_detail "Responsible warehouse" item.container.responsible %}  {% field_detail "Location (warehouse)" item.container.location %}  {% field "Precise localisation" item.container.divisions_lbl %} diff --git a/archaeological_finds/urls.py b/archaeological_finds/urls.py index 317afcb91..c9aaae2a2 100644 --- a/archaeological_finds/urls.py +++ b/archaeological_finds/urls.py @@ -227,8 +227,8 @@ urlpatterns = [          name='autocomplete-objecttype'),      url(r'autocomplete-materialtype/$', views.autocomplete_materialtype,          name='autocomplete-materialtype'), -    url(r'autocomplete-preservationtype/$', views.autocomplete_preservationtype, -        name='autocomplete-preservationtype'), +    url(r'autocomplete-treatmenttype/$', views.autocomplete_treatmenttype, +        name='autocomplete-treatmenttype'),      url(r'autocomplete-integritytype/$', views.autocomplete_integritytype,          name='autocomplete-integritytype'),      url(r'autocomplete-treatmentfile/$', views.autocomplete_treatmentfile, diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py index f2be734e7..53758f24a 100644 --- a/archaeological_finds/views.py +++ b/archaeological_finds/views.py @@ -245,8 +245,7 @@ find_source_deletion_wizard = FindSourceDeletionWizard.as_view([  autocomplete_objecttype = get_autocomplete_generic(models.ObjectType)  autocomplete_materialtype = get_autocomplete_generic(models.MaterialType) -autocomplete_preservationtype = get_autocomplete_generic( -    models.PreservationType) +autocomplete_treatmenttype = get_autocomplete_generic(models.TreatmentType)  autocomplete_integritytype = get_autocomplete_generic(models.IntegrityType) diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index f89343428..41891b341 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -247,6 +247,7 @@ class ContainerType(GeneralType):          verbose_name_plural = _(u"Container types")          ordering = ('label',) +  post_save.connect(post_save_cache, sender=ContainerType)  post_delete.connect(post_save_cache, sender=ContainerType) @@ -285,7 +286,7 @@ class Container(LightHistorizedItem, ImageModel):                                      null=True, blank=True)      cached_location = models.CharField(_(u"Cached location"), max_length=500,                                         null=True, blank=True) -    index = models.IntegerField(u"ID", default=0) +    index = models.IntegerField(u"Container ID", default=0)      external_id = models.TextField(_(u"External ID"), blank=True, null=True)      auto_external_id = models.BooleanField(          _(u"External ID is set automatically"), default=False) diff --git a/fixtures/initial_data-auth-fr.json b/fixtures/initial_data-auth-fr.json index 68fbeda88..43d11248b 100644 --- a/fixtures/initial_data-auth-fr.json +++ b/fixtures/initial_data-auth-fr.json @@ -3093,39 +3093,6 @@  {      "model": "auth.permission",      "fields": { -        "name": "Can add Preservation type", -        "content_type": [ -            "archaeological_finds", -            "preservationtype" -        ], -        "codename": "add_preservationtype" -    } -}, -{ -    "model": "auth.permission", -    "fields": { -        "name": "Can change Preservation type", -        "content_type": [ -            "archaeological_finds", -            "preservationtype" -        ], -        "codename": "change_preservationtype" -    } -}, -{ -    "model": "auth.permission", -    "fields": { -        "name": "Can delete Preservation type", -        "content_type": [ -            "archaeological_finds", -            "preservationtype" -        ], -        "codename": "delete_preservationtype" -    } -}, -{ -    "model": "auth.permission", -    "fields": {          "name": "Can add Integrity type",          "content_type": [              "archaeological_finds", diff --git a/ishtar_common/fixtures/initial_importtypes-fr.json b/ishtar_common/fixtures/initial_importtypes-fr.json index c5ca39297..4386b6de7 100644 --- a/ishtar_common/fixtures/initial_importtypes-fr.json +++ b/ishtar_common/fixtures/initial_importtypes-fr.json @@ -3432,7 +3432,7 @@      "model": "ishtar_common.formatertype",      "fields": {          "formater_type": "TypeFormater", -        "options": "archaeological_finds.models.PreservationType", +        "options": "archaeological_finds.models.TreatmentType",          "many_split": "&"      }  }, @@ -5312,7 +5312,7 @@          "regexp_filter": null,          "formater_type": [              "TypeFormater", -            "archaeological_finds.models.PreservationType", +            "archaeological_finds.models.TreatmentType",              "&"          ],          "force_new": false, @@ -7292,7 +7292,7 @@          "regexp_filter": null,          "formater_type": [              "TypeFormater", -            "archaeological_finds.models.PreservationType", +            "archaeological_finds.models.TreatmentType",              "&"          ],          "force_new": false, diff --git a/ishtar_common/models_imports.py b/ishtar_common/models_imports.py index d6106f33b..10e7be2e5 100644 --- a/ishtar_common/models_imports.py +++ b/ishtar_common/models_imports.py @@ -612,7 +612,7 @@ TARGET_MODELS = [      ('archaeological_finds.models.ConservatoryState',       _(u"Conservatory state")),      ('archaeological_warehouse.models.ContainerType', _(u"Container type")), -    ('archaeological_finds.models.PreservationType', _(u"Preservation type")), +    ('archaeological_finds.models.TreatmentType', _(u"Treatment type")),      ('archaeological_finds.models.ObjectType', _(u"Object type")),      ('archaeological_finds.models.IntegrityType', _(u"Integrity type")),      ('archaeological_finds.models.RemarkabilityType', | 
