diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-08-16 15:05:43 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-08-16 15:05:43 +0200 |
commit | 58cbaea8a20d17418d1613ea3b277242c932d2ac (patch) | |
tree | 48a3b167a477189f5cbcaf170158df416f24ca61 /archaeological_operations/models.py | |
parent | fe78f0db71ac7a9528925492c8521496dc6c36ed (diff) | |
download | Ishtar-58cbaea8a20d17418d1613ea3b277242c932d2ac.tar.bz2 Ishtar-58cbaea8a20d17418d1613ea3b277242c932d2ac.zip |
Manage properties in search vectors - add short code for operation (refs #4027)
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 9d6264a4d..435394592 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -446,6 +446,9 @@ class Operation(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter, "scientific_documentation_comment", "seizure_name", ] + PROPERTY_SEARCH_VECTORS = [ + "full_reference", "short_code_patriarche" + ] INT_SEARCH_VECTORS = ["year"] M2M_SEARCH_VECTORS = ["periods__label", "remains__label", "towns__name"] PARENT_SEARCH_VECTORS = ["associated_file"] @@ -846,10 +849,25 @@ class Operation(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter, return ref or "00" @property + def short_code_patriarche(self): + if not self.code_patriarche: + return u"" + profile = get_current_profile() + if not profile.operation_region_code or \ + not self.code_patriarche.startswith( + profile.operation_region_code): + return self.code_patriarche + return self.code_patriarche[len(profile.operation_region_code):] + + @property def reference(self): return self.get_reference() @property + def full_reference(self): + return self.get_reference(full=True) + + @property def report_delivery_delay(self): return None # q = self.source.filter(source_type__txt_idx__endswith='_report') |