From f394393163ee9a4789f2f69c6a68fce4369413db Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 24 Feb 2014 19:39:53 +0100 Subject: Document templates: add town values for archaeological operations and archaeological files --- archaeological_operations/models.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'archaeological_operations') diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 6a90b92b7..ae50b1a28 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -189,6 +189,15 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter): self.save() return self.cached_label + def get_values(self, prefix=''): + values = super(Operation, self).get_values(prefix=prefix) + values[prefix+'towns'] = '' + values[prefix+'towns_count'] = unicode(self.towns.count()) + if self.towns.count(): + values[prefix+'towns'] = u", ".join([town.name + for town in self.towns.all().order_by('name')]) + return values + @property def short_class_name(self): return _(u"OPE") -- cgit v1.2.3