diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-02-25 12:11:37 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-02-25 12:11:37 +0100 |
commit | cdb5af349c931fa12ccf642cf2080aa117dc4a1f (patch) | |
tree | 29d18903e39024ac46daf27eb2322a44252cd6ef /archaeological_operations/models.py | |
parent | 0a280ab1b2a3623780b74528d67debddd891fc6c (diff) | |
download | Ishtar-cdb5af349c931fa12ccf642cf2080aa117dc4a1f.tar.bz2 Ishtar-cdb5af349c931fa12ccf642cf2080aa117dc4a1f.zip |
Operations: bulk update of context records (refs #3472)
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 707537fe3..1f65b4c1f 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -431,13 +431,13 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, def get_reference(self, full=False): ref = "" if settings.COUNTRY == 'fr' and self.code_patriarche: - ref = "OA" + unicode(self.code_patriarche) + ref = settings.ISHTAR_OPE_PREFIX + unicode(self.code_patriarche) if not full: return ref if self.year and self.operation_code: if ref: ref += u" - " - ref += settings.OP_PREFIX + ref += settings.ISHTAR_DEF_OPE_PREFIX ref += u"-".join((unicode(self.year), unicode(self.operation_code))) return ref or "00" @@ -463,6 +463,12 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, def _get_associated_cached_labels(self): return list(self.context_record.all()) + def _cached_labels_bulk_update(self): + if settings.USE_SPATIALITE_FOR_TESTS: + return + self.context_record.model.cached_label_bulk_update(operation_id=self.pk) + return True + def get_town_label(self): lbl = unicode(_('Intercommunal')) if self.towns.count() == 1: @@ -518,15 +524,15 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, return "" lbl = unicode(self.operation_code) year = self.year or 0 - lbl = settings.OP_PREFIX + u"%d-%s%s" % (year, (3 - len(lbl)) * "0", - lbl) + lbl = settings.ISHTAR_DEF_OPE_PREFIX \ + + u"%d-%s%s" % (year, (3 - len(lbl)) * "0", lbl) return lbl @property def full_code_patriarche(self): if not self.code_patriarche: return '' - return u"OA" + unicode(self.code_patriarche) + return settings.ISHTAR_OPE_PREFIX + unicode(self.code_patriarche) def clean(self): if not self.operation_code: |