diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-05-07 15:36:12 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-05-07 15:41:50 +0200 |
commit | 3c20f955b08f8082ec624c8c12dc991e5069d420 (patch) | |
tree | ba6d69336195e90df53928274de9746436bb1697 | |
parent | eb0f7d6c72487a9bdaa92f7f80b2231d1d3716f0 (diff) | |
download | Ishtar-3c20f955b08f8082ec624c8c12dc991e5069d420.tar.bz2 Ishtar-3c20f955b08f8082ec624c8c12dc991e5069d420.zip |
Imports: use the first formater for duplicates fields
-rw-r--r-- | archaeological_finds/models_finds.py | 30 | ||||
-rw-r--r-- | ishtar_common/data_importer.py | 24 | ||||
-rw-r--r-- | ishtar_common/models.py | 4 | ||||
-rw-r--r-- | ishtar_common/models_imports.py | 8 |
4 files changed, 36 insertions, 30 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index b0c5a0332..68a7bfe51 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -408,11 +408,11 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, GeoItem, OwnPerms, :return: True if index has been changed. """ profile = get_current_profile() - if profile.find_index == u'O': + if profile.find_index == 'O': operation = self.context_record.operation q = BaseFind.objects \ .filter(context_record__operation=operation) - elif profile.find_index == u'CR': + elif profile.find_index == 'CR': cr = self.context_record q = BaseFind.objects \ .filter(context_record=cr) @@ -438,7 +438,7 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, GeoItem, OwnPerms, elif ope.year and ope.operation_code: c_id.append( profile.default_operation_prefix + - str(ope.year or '') + u"-" + + str(ope.year or '') + "-" + str(ope.operation_code or '')) else: c_id.append('') @@ -1732,19 +1732,19 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem, @property def name(self): - return u" - ".join([base_find.name + return " - ".join([base_find.name for base_find in self.base_finds.all()]) @property def full_label(self): - lbl = u" - ".join([getattr(self, attr) + lbl = " - ".join([getattr(self, attr) for attr in ( 'label', 'denomination', 'administrative_index') if getattr(self, attr)]) - base = u" - ".join([base_find.complete_id() + base = " - ".join([base_find.complete_id() for base_find in self.base_finds.all()]) if base: - lbl += u' ({})'.format(base) + lbl += ' ({})'.format(base) return lbl def get_first_base_find(self): @@ -1811,10 +1811,10 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem, if self.id: bf = self.get_first_base_find() if not bf: - return u"detached/{}".format(self.SLUG) + return "detached/{}".format(self.SLUG) ope = bf.context_record.operation - find_idx = u'{:0' + str(settings.ISHTAR_FINDS_INDEX_ZERO_LEN) + 'd}' - return (u"{}/{}/" + find_idx).format( + find_idx = '{:0' + str(settings.ISHTAR_FINDS_INDEX_ZERO_LEN) + 'd}' + return ("{}/{}/" + find_idx).format( ope._get_base_image_path(), self.SLUG, self.index) @property @@ -1831,7 +1831,7 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem, |