diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-12-22 12:46:24 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-12-22 12:46:24 +0100 |
commit | 7f1d9db82a29af007715eb786cc736277041704e (patch) | |
tree | de97ca38038965b23760ba2034c2327ccf23e671 /archaeological_finds | |
parent | b1c94c5f5949ba5514a95918187b223c78d4b986 (diff) | |
download | Ishtar-7f1d9db82a29af007715eb786cc736277041704e.tar.bz2 Ishtar-7f1d9db82a29af007715eb786cc736277041704e.zip |
Manage cached_label for treatments - display full label in finds tables (refs #3395)
Diffstat (limited to 'archaeological_finds')
-rw-r--r-- | archaeological_finds/models.py | 2 | ||||
-rw-r--r-- | archaeological_finds/models_finds.py | 38 | ||||
-rw-r--r-- | archaeological_finds/models_treatments.py | 2 |
3 files changed, 28 insertions, 14 deletions
diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py index f9d93b1a9..7d56bb771 100644 --- a/archaeological_finds/models.py +++ b/archaeological_finds/models.py @@ -13,4 +13,4 @@ __all__ = ['MaterialType', 'ConservatoryState', 'PreservationType', 'TreatmentType', 'Treatment', 'AbsFindTreatments', 'FindUpstreamTreatments', 'FindDownstreamTreatments', 'FindTreatments', 'TreatmentSource', 'TreatmentFile', - 'TreatmentFileType', 'TreatmentFileSource']
\ No newline at end of file + 'TreatmentFileType', 'TreatmentFileSource'] diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index be6037eaa..e1fcb38b7 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -295,7 +295,7 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): 'base_finds__context_record__parcel__town', 'base_finds__context_record__operation__year', 'base_finds__context_record__operation__operation_code', - 'container__reference', 'container__location', + 'container__cached_label', 'base_finds__batch', 'base_finds__context_record__parcel__town', 'base_finds__context_record__parcel', ] @@ -307,11 +307,13 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): 'base_finds__cache_complete_id', 'previous_id', 'label', 'material_types', 'datings__period__label', 'find_number', 'object_types', + 'container__cached_label', 'description', 'base_finds__context_record__parcel__town', 'base_finds__context_record__parcel', ] - TABLE_COLS_FOR_OPE_LBL = { + COL_LABELS = { 'datings__period__label': _(u"Periods"), + 'container__cached_label': _(u"Container"), } EXTRA_FULL_FIELDS = [ @@ -369,6 +371,18 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): 'basket': 'basket', 'cached_label': 'cached_label__icontains', 'image': 'image__isnull'} + EXTRA_REQUEST_KEYS.update( + dict( + [(key, key) for key in TABLE_COLS + if key not in EXTRA_REQUEST_KEYS] + ) + ) + EXTRA_REQUEST_KEYS.update( + dict( + [(key, key) for key in TABLE_COLS_FOR_OPE + if key not in EXTRA_REQUEST_KEYS] + ) + ) # fields base_finds = models.ManyToManyField(BaseFind, verbose_name=_(u"Base find"), @@ -486,10 +500,9 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): @property def full_label(self): - lbl = u" - ".join([ - getattr(self, attr) - for attr in ('label', 'administrative_index') - if getattr(self, attr)]) + lbl = u" - ".join([getattr(self, attr) + for attr in ('label', 'administrative_index') + if getattr(self, attr)]) base = u" - ".join([base_find.complete_id() for base_find in self.base_finds.all()]) if base: @@ -641,9 +654,9 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): def get_query_owns(cls, user): return Q(base_finds__context_record__operation__scientist=user. ishtaruser.person) | \ - Q(base_finds__context_record__operation__in_charge=user. - ishtaruser.person) | \ - Q(history_creator=user) + Q(base_finds__context_record__operation__in_charge=user. + ishtaruser.person) | \ + Q(history_creator=user) @classmethod def get_owns(cls, user, menu_filtr=None, limit=None): @@ -737,9 +750,10 @@ m2m_changed.connect(base_find_find_changed, sender=Find.base_finds.through) class FindSource(Source): SHOW_URL = 'show-findsource' MODIFY_URL = 'find_source_modify' - TABLE_COLS = ['find__base_finds__context_record__operation', - 'find__base_finds__context_record', 'find'] + \ - Source.TABLE_COLS + TABLE_COLS = [ + 'find__base_finds__context_record__operation', + 'find__base_finds__context_record', 'find'] + \ + Source.TABLE_COLS # search parameters BOOL_FIELDS = ['duplicate'] diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index 95817fc40..0f8b4796a 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -71,7 +71,7 @@ class Treatment(BaseHistorizedItem, ImageModel, OwnPerms): "upstream_cached_label": "upstream__cached_label", 'image': 'image__isnull', } - TABLE_COLS_LBL = { + COL_LABELS = { "downstream_cached_label": _(u"Downstream find"), "upstream_cached_label": _(u"Upstream find"), } |