diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-01-13 13:01:06 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-01-13 13:01:06 +0100 |
commit | a2312380213fb30b88da6115663d8f9d72aced7b (patch) | |
tree | caf077a59d9eefffee884e5282e45cf2bf355564 /ishtar_common/models.py | |
parent | 6ca6335acfc04717667d30738ca0e2ce1c7fdc4c (diff) | |
download | Ishtar-a2312380213fb30b88da6115663d8f9d72aced7b.tar.bz2 Ishtar-a2312380213fb30b88da6115663d8f9d72aced7b.zip |
Merge: display address for persons and organizations
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 23 |
1 files changed, 23 insertions, 0 deletions
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, |