From cf6859ae0cdf032dff739ae8459786cb7640306e Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 15 Jun 2018 18:58:31 +0200 Subject: Small optimization --- archaeological_operations/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index fd2559626..d50c9e43c 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -612,13 +612,13 @@ class Operation(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter, def get_town_label(self): lbl = unicode(_('Intercommunal')) if self.towns.count() == 1: - lbl = self.towns.all()[0].name + lbl = self.towns.values('name').all()[0]['name'] return lbl def get_department(self): if not self.towns.count(): return '00' - return self.towns.all()[0].numero_insee[:2] + return self.towns.values('numero_insee').all()[0]['numero_insee'][:2] def grouped_parcels(self): return Parcel.grouped_parcels(list(self.parcels.all())) -- cgit v1.2.3