From e44cf85ed6990189d7d73e7a969a5969dd7bfc5e Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 14 Nov 2016 17:16:30 +0100 Subject: Update translations files --- archaeological_finds/locale/django.pot | 176 ++++++++++++++++----------------- 1 file changed, 88 insertions(+), 88 deletions(-) (limited to 'archaeological_finds') diff --git a/archaeological_finds/locale/django.pot b/archaeological_finds/locale/django.pot index 93a83eb05..9c2550def 100644 --- a/archaeological_finds/locale/django.pot +++ b/archaeological_finds/locale/django.pot @@ -12,21 +12,21 @@ msgstr "" msgid "Context record" msgstr "" -#: forms.py:83 ishtar_menu.py:31 models.py:439 models.py:750 models.py:850 -#: models.py:1000 templates/ishtar/sheet_find.html:5 +#: forms.py:83 ishtar_menu.py:31 models.py:440 models.py:754 models.py:854 +#: models.py:1004 templates/ishtar/sheet_find.html:5 msgid "Find" msgstr "" -#: forms.py:94 forms.py:218 forms.py:425 models.py:127 models.py:376 +#: forms.py:94 forms.py:218 forms.py:425 models.py:127 models.py:377 msgid "Free ID" msgstr "" -#: forms.py:96 models.py:425 +#: forms.py:96 models.py:426 msgid "Previous ID" msgstr "" -#: forms.py:97 forms.py:250 forms.py:591 models.py:131 models.py:377 -#: models.py:784 +#: forms.py:97 forms.py:250 forms.py:591 models.py:131 models.py:378 +#: models.py:788 msgid "Description" msgstr "" @@ -34,7 +34,7 @@ msgstr "" msgid "Batch/object" msgstr "" -#: forms.py:102 models.py:405 +#: forms.py:102 models.py:406 msgid "Is complete?" msgstr "" @@ -42,15 +42,15 @@ msgstr "" msgid "Material type" msgstr "" -#: forms.py:106 forms.py:244 models.py:62 models.py:381 +#: forms.py:106 forms.py:244 models.py:62 models.py:382 msgid "Conservatory state" msgstr "" -#: forms.py:109 models.py:383 +#: forms.py:109 models.py:384 msgid "Conservatory comment" msgstr "" -#: forms.py:112 models.py:102 models.py:408 +#: forms.py:112 models.py:102 models.py:409 msgid "Object types" msgstr "" @@ -58,67 +58,67 @@ msgstr "" msgid "Preservation type" msgstr "" -#: forms.py:117 forms.py:246 models.py:410 +#: forms.py:117 forms.py:246 models.py:411 msgid "Integrity / interest" msgstr "" -#: forms.py:120 forms.py:248 models.py:413 +#: forms.py:120 forms.py:248 models.py:414 msgid "Remarkability" msgstr "" -#: forms.py:122 models.py:415 +#: forms.py:122 models.py:416 msgid "Length (cm)" msgstr "" -#: forms.py:123 models.py:416 +#: forms.py:123 models.py:417 msgid "Width (cm)" msgstr "" -#: forms.py:124 models.py:417 +#: forms.py:124 models.py:418 msgid "Height (cm)" msgstr "" -#: forms.py:125 models.py:418 +#: forms.py:125 models.py:419 msgid "Diameter (cm)" msgstr "" -#: forms.py:126 forms.py:430 models.py:388 +#: forms.py:126 forms.py:430 models.py:389 msgid "Volume (l)" msgstr "" -#: forms.py:127 forms.py:431 models.py:389 +#: forms.py:127 forms.py:431 models.py:390 msgid "Weight (g)" msgstr "" -#: forms.py:129 models.py:419 +#: forms.py:129 models.py:420 msgid "Dimensions comment" msgstr "" -#: forms.py:130 forms.py:432 models.py:392 +#: forms.py:130 forms.py:432 models.py:393 msgid "Find number" msgstr "" -#: forms.py:131 models.py:421 +#: forms.py:131 models.py:422 msgid "Mark" msgstr "" -#: forms.py:132 forms.py:254 models.py:427 +#: forms.py:132 forms.py:254 models.py:428 msgid "Check" msgstr "" -#: forms.py:134 models.py:429 +#: forms.py:134 models.py:430 msgid "Check date" msgstr "" -#: forms.py:135 models.py:132 models.py:422 models.py:785 +#: forms.py:135 models.py:132 models.py:423 models.py:789 msgid "Comment" msgstr "" -#: forms.py:138 models.py:423 +#: forms.py:138 models.py:424 msgid "Comment on dating" msgstr "" -#: forms.py:139 models.py:431 +#: forms.py:139 models.py:432 msgid "Estimated value" msgstr "" @@ -133,7 +133,7 @@ msgid "" "p>" msgstr "" -#: forms.py:181 forms.py:212 models.py:400 +#: forms.py:181 forms.py:212 models.py:401 msgid "Dating" msgstr "" @@ -141,12 +141,12 @@ msgstr "" msgid "Period" msgstr "" -#: forms.py:187 forms.py:593 models.py:798 models.py:863 models.py:1005 +#: forms.py:187 forms.py:593 models.py:802 models.py:867 models.py:1009 #: templates/ishtar/sheet_find.html:92 templates/ishtar/sheet_find.html:121 msgid "Start date" msgstr "" -#: forms.py:189 forms.py:595 models.py:799 models.py:864 models.py:1006 +#: forms.py:189 forms.py:595 models.py:803 models.py:868 models.py:1010 #: templates/ishtar/sheet_find.html:93 templates/ishtar/sheet_find.html:122 msgid "End date" msgstr "" @@ -207,7 +207,7 @@ msgstr "" msgid "Upstream finds" msgstr "" -#: forms.py:326 models.py:440 +#: forms.py:326 models.py:441 msgid "Finds" msgstr "" @@ -283,16 +283,16 @@ msgstr "" msgid "Base treatment" msgstr "" -#: forms.py:578 models.py:772 models.py:787 models.py:862 +#: forms.py:578 models.py:776 models.py:791 models.py:866 msgid "Treatment type" msgstr "" -#: forms.py:580 models.py:796 models.py:867 +#: forms.py:580 models.py:800 models.py:871 #: templates/ishtar/sheet_find.html:90 templates/ishtar/sheet_find.html:119 msgid "Doer" msgstr "" -#: forms.py:586 models.py:789 models.py:865 +#: forms.py:586 models.py:793 models.py:869 msgid "Location" msgstr "" @@ -344,7 +344,7 @@ msgstr "" msgid "Parent material" msgstr "" -#: models.py:51 models.py:379 +#: models.py:51 models.py:380 msgid "Material types" msgstr "" @@ -392,11 +392,11 @@ msgstr "" msgid "Batch" msgstr "" -#: models.py:128 models.py:372 models.py:780 +#: models.py:128 models.py:373 models.py:784 msgid "External ID" msgstr "" -#: models.py:130 models.py:374 +#: models.py:130 models.py:375 msgid "External ID is set automatically" msgstr "" @@ -436,7 +436,7 @@ msgstr "" msgid "Cached value - do not edit" msgstr "" -#: models.py:159 models.py:370 +#: models.py:159 models.py:371 msgid "Base find" msgstr "" @@ -464,209 +464,209 @@ msgstr "" msgid "Can delete own Base find" msgstr "" -#: models.py:275 +#: models.py:276 msgid "g" msgstr "" -#: models.py:276 +#: models.py:277 msgid "kg" msgstr "" -#: models.py:278 +#: models.py:279 msgid "Not checked" msgstr "" -#: models.py:279 +#: models.py:280 msgid "Checked but incorrect" msgstr "" -#: models.py:280 +#: models.py:281 msgid "Checked and correct" msgstr "" -#: models.py:320 +#: models.py:321 msgid "Base find - Short ID" msgstr "" -#: models.py:321 +#: models.py:322 msgid "Base find - Complete ID" msgstr "" -#: models.py:322 +#: models.py:323 msgid "Base find - Comment" msgstr "" -#: models.py:323 +#: models.py:324 msgid "Base find - Description" msgstr "" -#: models.py:324 +#: models.py:325 msgid "Base find - Topographic localisation" msgstr "" -#: models.py:326 +#: models.py:327 msgid "Base find - Special interest" msgstr "" -#: models.py:327 +#: models.py:328 msgid "Base find - Discovery date" msgstr "" -#: models.py:375 models.py:856 +#: models.py:376 models.py:860 msgid "Order" msgstr "" -#: models.py:386 +#: models.py:387 msgid "Type of preservation to consider" msgstr "" -#: models.py:390 +#: models.py:391 msgid "Weight unit" msgstr "" -#: models.py:396 templates/ishtar/sheet_find.html:83 +#: models.py:397 templates/ishtar/sheet_find.html:83 msgid "Upstream treatment" msgstr "" -#: models.py:399 templates/ishtar/sheet_find.html:112 +#: models.py:400 templates/ishtar/sheet_find.html:112 msgid "Downstream treatment" msgstr "" -#: models.py:403 models.py:782 models.py:866 +#: models.py:404 models.py:786 models.py:870 #: templates/ishtar/sheet_find.html:91 templates/ishtar/sheet_find.html:120 msgid "Container" msgstr "" -#: models.py:433 +#: models.py:434 msgid "Cached name" msgstr "" -#: models.py:442 +#: models.py:443 msgid "Can view all Finds" msgstr "" -#: models.py:443 +#: models.py:444 msgid "Can view own Find" msgstr "" -#: models.py:444 +#: models.py:445 msgid "Can add own Find" msgstr "" -#: models.py:445 +#: models.py:446 msgid "Can change own Find" msgstr "" -#: models.py:446 +#: models.py:447 msgid "Can delete own Find" msgstr "" -#: models.py:452 +#: models.py:453 msgid "FIND" msgstr "" -#: models.py:748 +#: models.py:752 msgid "Find documentation" msgstr "" -#: models.py:749 +#: models.py:753 msgid "Find documentations" msgstr "" -#: models.py:759 +#: models.py:763 msgid "Virtual" msgstr "" -#: models.py:761 +#: models.py:765 msgid "Upstream is many" msgstr "" -#: models.py:763 +#: models.py:767 msgid "Check this if for this treatment from many finds you'll get one." msgstr "" -#: models.py:766 +#: models.py:770 msgid "Downstream is many" msgstr "" -#: models.py:768 +#: models.py:772 msgid "Check this if for this treatment from one find you'll get many." msgstr "" -#: models.py:773 +#: models.py:777 msgid "Treatment types" msgstr "" -#: models.py:791 +#: models.py:795 msgid "Location where the treatment is done. Target warehouse for a move." msgstr "" -#: models.py:793 +#: models.py:797 msgid "Other location" msgstr "" -#: models.py:803 models.py:852 models.py:992 +#: models.py:807 models.py:856 models.py:996 msgid "Treatment" msgstr "" -#: models.py:804 templates/ishtar/sheet_find.html:80 +#: models.py:808 templates/ishtar/sheet_find.html:80 msgid "Treatments" msgstr "" -#: models.py:806 +#: models.py:810 msgid "Can view all Treatments" msgstr "" -#: models.py:807 +#: models.py:811 msgid "Can view own Treatment" msgstr "" -#: models.py:808 +#: models.py:812 msgid "Can add own Treatment" msgstr "" -#: models.py:809 +#: models.py:813 msgid "Can change own Treatment" msgstr "" -#: models.py:810 +#: models.py:814 msgid "Can delete own Treatment" msgstr "" -#: models.py:816 +#: models.py:820 msgid "by" msgstr "" -#: models.py:868 models.py:869 templates/ishtar/sheet_find.html:89 +#: models.py:872 models.py:873 templates/ishtar/sheet_find.html:89 #: templates/ishtar/sheet_find.html:118 msgid "Related finds" msgstr "" -#: models.py:978 +#: models.py:982 msgid "Is upstream" msgstr "" -#: models.py:989 +#: models.py:993 msgid "Treatment documentation" msgstr "" -#: models.py:990 +#: models.py:994 msgid "Treament documentations" msgstr "" -#: models.py:1002 +#: models.py:1006 msgid "Administrative act" msgstr "" -#: models.py:1003 +#: models.py:1007 msgid "Person" msgstr "" -#: models.py:1009 +#: models.py:1013 msgid "Property" msgstr "" -#: models.py:1010 +#: models.py:1014 msgid "Properties" msgstr "" -- cgit v1.2.3 From 4778f7ab57c5bbd1ec1ff6a0e3bd9e1561ddf454 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 14 Nov 2016 19:43:27 +0100 Subject: Explicit CSV headers (refs #3340) --- archaeological_context_records/models.py | 13 ++++++-- archaeological_finds/models.py | 54 ++++++++++++++++---------------- archaeological_operations/models.py | 22 +++++++++++++ ishtar_common/models.py | 13 ++++++-- ishtar_common/views.py | 11 +++++-- 5 files changed, 80 insertions(+), 33 deletions(-) (limited to 'archaeological_finds') diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 3f4dc1598..22ff3b095 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -29,7 +29,7 @@ from ishtar_common.utils import cached_label_changed from ishtar_common.models import GeneralType, BaseHistorizedItem, \ HistoricalRecords, OwnPerms, ShortMenuItem, Source, GeneralRelationType,\ GeneralRecordRelations, post_delete_record_relation, get_external_id, \ - ImageModel, post_save_cache + ImageModel, post_save_cache, ValueGetter from archaeological_operations.models import Operation, Period, Parcel @@ -118,7 +118,8 @@ post_save.connect(post_save_cache, sender=IdentificationType) post_delete.connect(post_save_cache, sender=IdentificationType) -class ContextRecord(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): +class ContextRecord(BaseHistorizedItem, ImageModel, OwnPerms, + ValueGetter, ShortMenuItem): SHOW_URL = 'show-contextrecord' SLUG = 'contextrecord' TABLE_COLS = ['parcel__town', 'operation__year', @@ -155,6 +156,14 @@ class ContextRecord(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): RELATIVE_SESSION_NAMES = [ ('operation', 'operation__pk'), ('file', 'operation__associated_file__pk')] + EXTRA_FULL_FIELDS_LABELS = { + 'parcel__town': _(u"Parcel (town)"), + 'detailled_related_context_records': _(u"Related context records"), + 'operation__code_patriarche': u"Operation (code patriarche)", + 'parcel__external_id': _(u"Parcel (external ID)"), + 'datings__period': _(u"Datings (period)"), + 'parcel__year': _(u"Parcel (year)"), + } # fields external_id = models.TextField(_(u"External ID"), blank=True, null=True) diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py index aa5eacc30..6dcbbce65 100644 --- a/archaeological_finds/models.py +++ b/archaeological_finds/models.py @@ -291,41 +291,41 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): CHECK_DICT = dict(CHECK_CHOICES) SHOW_URL = 'show-find' SLUG = 'find' - TABLE_COLS = ['label', 'material_types', 'datings.period', - 'base_finds.context_record.parcel.town', - 'base_finds.context_record.operation.year', - 'base_finds.context_record.operation.operation_code', - 'container.reference', 'container.location', - 'base_finds.batch', - 'base_finds.context_record.parcel.town', - 'base_finds.context_record.parcel', ] + TABLE_COLS = ['label', 'material_types', 'datings__period', + 'base_finds__context_record__parcel__town', + 'base_finds__context_record__operation__year', + 'base_finds__context_record__operation__operation_code', + 'container__reference', 'container__location', + 'base_finds__batch', + 'base_finds__context_record__parcel__town', + 'base_finds__context_record__parcel', ] if settings.COUNTRY == 'fr': TABLE_COLS.insert( - 6, 'base_finds.context_record.operation.code_patriarche') + 6, 'base_finds__context_record__operation__code_patriarche') TABLE_COLS_FOR_OPE = [ - 'base_finds.cache_short_id', - 'base_finds.cache_complete_id', + 'base_finds__cache_short_id', + 'base_finds__cache_complete_id', 'previous_id', 'label', 'material_types', - 'datings.period', 'find_number', 'object_types', + 'datings__period', 'find_number', 'object_types', 'description', - 'base_finds.context_record.parcel.town', - 'base_finds.context_record.parcel', ] + 'base_finds__context_record__parcel__town', + 'base_finds__context_record__parcel', ] EXTRA_FULL_FIELDS = [ - 'base_finds.cache_short_id', 'base_finds.cache_complete_id', - 'base_finds.comment', 'base_finds.description', - 'base_finds.topographic_localisation', - 'base_finds.special_interest', - 'base_finds.discovery_date'] + 'base_finds__cache_short_id', 'base_finds__cache_complete_id', + 'base_finds__comment', 'base_finds__description', + 'base_finds__topographic_localisation', + 'base_finds__special_interest', + 'base_finds__discovery_date'] EXTRA_FULL_FIELDS_LABELS = { - 'base_finds.cache_short_id': _(u"Base find - Short ID"), - 'base_finds.cache_complete_id': _(u"Base find - Complete ID"), - 'base_finds.comment': _(u"Base find - Comment"), - 'base_finds.description': _(u"Base find - Description"), - 'base_finds.topographic_localisation': _(u"Base find - " - u"Topographic localisation"), - 'base_finds.special_interest': _(u"Base find - Special interest"), - 'base_finds.discovery_date': _(u"Base find - Discovery date"), + 'base_finds__cache_short_id': _(u"Base find - Short ID"), + 'base_finds__cache_complete_id': _(u"Base find - Complete ID"), + 'base_finds__comment': _(u"Base find - Comment"), + 'base_finds__description': _(u"Base find - Description"), + 'base_finds__topographic_localisation': _(u"Base find - " + u"Topographic localisation"), + 'base_finds__special_interest': _(u"Base find - Special interest"), + 'base_finds__discovery_date': _(u"Base find - Discovery date"), } ATTRS_EQUIV = {'get_first_base_find': 'base_finds'} diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 14e5e1f7e..1e108e98c 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -225,6 +225,28 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, 'finds_deadline_before': 'finds_deadline__lte', 'finds_deadline_after': 'finds_deadline__gte', } + EXTRA_FULL_FIELDS_LABELS = { + 'full_code_patriarche': u"Code patriarche", + 'year_index': _(u"Year - Index"), + 'associated_file_short_label': _(u"Associated file (label)"), + 'operator__name': _(u"Operator name"), + 'scientist__raw_name': _(u"Scientist (full name)"), + 'associated_file__external_id': _(u"Associated file (external ID)"), + 'scientist__title': _(u"Scientist (title)"), + 'scientist__surname': _(u"Scientist (surname)"), + 'scientist__name': _(u"Scientist (name)"), + 'scientist__attached_to__name': _(u"Scientist - Organization (name)"), + 'in_charge__title': _(u"In charge (title)"), + 'in_charge__surname': _(u"In charge (surname)"), + 'in_charge__name': _(u"In charge (name)"), + 'in_charge__attached_to__name': _(u"In charge - Organization (name)"), + 'cira_rapporteur__surname': u"Rapporteur CIRA (prénom)", + 'cira_rapporteur__name': u"Rapporteur CIRA (nom)", + 'cira_rapporteur__attached_to__name': u"Rapporteur CIRA - " + u"Organisation (nom)", + 'archaeological_sites__reference': _(u"Archaeological sites (" + u"reference)"), + } # fields definition creation_date = models.DateField(_(u"Creation date"), diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 72a3432f8..5b822c7dd 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -25,6 +25,7 @@ import copy import datetime from PIL import Image from importlib import import_module +import logging import os import re import shutil @@ -65,6 +66,9 @@ from ishtar_common.data_importer import Importer, ImportFormater, \ TypeFormater, YearFormater, StrToBoolean, FileFormater +logger = logging.getLogger(__name__) + + def post_save_user(sender, **kwargs): user = kwargs['instance'] try: @@ -95,6 +99,7 @@ class Imported(models.Model): class ValueGetter(object): _prefix = "" GET_VALUES_EXTRA = [] + EXTRA_FULL_FIELDS_LABELS = {} def get_values(self, prefix=''): if not prefix: @@ -1607,7 +1612,7 @@ def get_importer_models(): ('archaeological_context_records.models.RecordRelations', _(u"Context record relations"))] + MODELS MODELS = [('archaeological_finds.models.BaseFind', - _(u"Finds")), ] + MODELS + _(u"Base finds")), ] + MODELS return MODELS @@ -1995,7 +2000,9 @@ TARGET_MODELS = [ ('archaeological_operations.models.OperationType', _(u"Operation type")), ('archaeological_operations.models.Period', _(u"Period")), ('archaeological_operations.models.ReportState', _(u"Report state")), + ('archaeological_operations.models.RemainType', _(u"Remain type")), ('archaeological_context_records.models.Unit', _(u"Unit")), + ('archaeological_context_records.models.ActivityType', _(u"Activity type")), ('archaeological_finds.models.MaterialType', _(u"Material")), ('archaeological_finds.models.ConservatoryState', _(u"Conservatory state")), @@ -2077,7 +2084,9 @@ class FormaterType(models.Model): kwargs['many_split'] = self.many_split if self.formater_type == 'TypeFormater': if self.options not in TARGET_MODELS_KEYS: - print('%s not in TARGET_MODELS_KEYS' % self.options) + logger.warning( + "**WARN FormaterType.get_formater_type**: {} " + "is not in TARGET_MODELS_KEYS".format(self.options)) return model = None if self.options in dir(): diff --git a/ishtar_common/views.py b/ishtar_common/views.py index cd34a2019..8634125cd 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -981,8 +981,8 @@ def get_item(model, func_name, default_name, extra_request_keys=[], lnk = link_template % reverse('show-' + default_name, args=[data[0], '']) except NoReverseMatch: - print( - '"show-' + default_name + "\" args (" + logger.warning( + '**WARN "show-' + default_name + '" args (' + unicode(data[0]) + ") url not available") lnk = '' res = {'id': data[0], 'link': lnk} @@ -1027,6 +1027,8 @@ def get_item(model, func_name, default_name, extra_request_keys=[], writer = csv.writer(response, **CSV_OPTIONS) col_names = [] for field_name in table_cols: + if type(field_name) in (list, tuple): + field_name = " ; ".join(field_name) if hasattr(model, 'EXTRA_FULL_FIELDS_LABELS') and\ field_name in model.EXTRA_FULL_FIELDS_LABELS: field = model.EXTRA_FULL_FIELDS_LABELS[field_name] @@ -1037,6 +1039,11 @@ def get_item(model, func_name, default_name, extra_request_keys=[], field = model._meta.get_field(field_name) except: col_names.append(u"".encode(ENCODING)) + logger.warning( + "**WARN get_item - csv export**: no col name for " + "{}\nadd explicit label to " + "EXTRA_FULL_FIELDS_LABELS attribute of " + "{}".format(field_name, model)) continue col_names.append( unicode(field.verbose_name).encode(ENCODING)) -- cgit v1.2.3