From 492747e5a6098d302c95b938fd6b9ae52438681d Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 13 Jan 2016 13:01:06 +0100 Subject: Merge: display address for persons and organizations --- ishtar_common/models.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'ishtar_common/models.py') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index af1c70dce..2745bf4b6 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1069,6 +1069,29 @@ class Address(BaseHistorizedItem): class Meta: abstract = True + def address_lbl(self): + lbl = '' + if self.address: + lbl += self.address + if self.address_complement: + if lbl: + lbl += "\n" + lbl += self.address_complement + if self.postal_code or self.town: + if lbl: + lbl += "\n" + lbl += "{}{}{}".format( + self.postal_code or '', + " " if self.postal_code and self.town else '', + self.town or '') + if self.phone: + lbl += "{}{}".format(_("Tel:"), self.phone) + if self.mobile_phone: + lbl += "{}{}".format(_("Mobile: "), self.mobile_phone) + if self.email: + lbl += "{}{}".format(_("Email: "), self.email) + return lbl + class Merge(models.Model): merge_key = models.CharField(_("Merge key"), max_length=300, -- cgit v1.2.3