diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2014-10-24 13:42:37 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2014-10-24 13:42:37 +0200 |
commit | b6db7950c34b4390fa3dc20ef2bf86b2ccc87b60 (patch) | |
tree | de45527c8564ac6509605ca55c9548619dd97e6b /archaeological_operations/models.py | |
parent | 11b8dd877b3ba1a3a8aec39166f025eb1f2beeb4 (diff) | |
download | Ishtar-b6db7950c34b4390fa3dc20ef2bf86b2ccc87b60.tar.bz2 Ishtar-b6db7950c34b4390fa3dc20ef2bf86b2ccc87b60.zip |
Add internal ref in quick view (refs #2085)
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index a4a225ff0..0823118e0 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -271,14 +271,22 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, def show_url(self): return reverse('show-operation', args=[self.pk, '']) - @property - def reference(self): + def get_reference(self, full=False): + ref = "" if self.code_patriarche: - return unicode(self.code_patriarche) + ref = unicode(self.code_patriarche) + if not full: + return ref if self.year and self.operation_code: - return u"-".join((unicode(self.year), + if ref: + ref += u" - " + ref += u"-".join((unicode(self.year), unicode(self.operation_code))) - return "00" + return ref or "00" + + @property + def reference(self): + return self.get_reference() @property def report_delivery_delay(self): @@ -289,7 +297,7 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, def _generate_cached_label(self): - items = [self.get_town_label(), self.reference] + items = [self.get_town_label(), self.get_reference(full=True)] if self.common_name: items.append(self.common_name) cached_label = settings.JOINT.join(items) |