summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/models.py31
-rw-r--r--ishtar_common/templates/ishtar/blocks/window_field.html2
2 files changed, 28 insertions, 5 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 2745bf4b6..61376e079 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1069,8 +1069,18 @@ class Address(BaseHistorizedItem):
class Meta:
abstract = True
+ def simple_lbl(self):
+ return unicode(self)
+
+ def full_address(self):
+ lbl = self.simple_lbl()
+ if lbl:
+ lbl += u"\n"
+ lbl += self.address_lbl()
+ return lbl
+
def address_lbl(self):
- lbl = ''
+ lbl = u''
if self.address:
lbl += self.address
if self.address_complement:
@@ -1085,11 +1095,11 @@ class Address(BaseHistorizedItem):
" " if self.postal_code and self.town else '',
self.town or '')
if self.phone:
- lbl += "{}{}".format(_("Tel:"), self.phone)
+ lbl += "{}{}".format(unicode(_("Tel:")), self.phone)
if self.mobile_phone:
- lbl += "{}{}".format(_("Mobile: "), self.mobile_phone)
+ lbl += "{}{}".format(unicode(_("Mobile: ")), self.mobile_phone)
if self.email:
- lbl += "{}{}".format(_("Email: "), self.email)
+ lbl += "{}{}".format(unicode(_("Email: ")), self.email)
return lbl
@@ -1880,6 +1890,12 @@ class Organization(Address, Merge, OwnPerms, ValueGetter):
ugettext(u"Can delete own Organization")),
)
+ def simple_lbl(self):
+ if self.name:
+ return self.name
+ return u"{} - {}".format(self.organization_type,
+ self.town or "")
+
def __unicode__(self):
if self.name:
return self.name
@@ -1949,6 +1965,13 @@ class Person(Address, Merge, OwnPerms, ValueGetter):
("delete_own_person", ugettext(u"Can delete own Person")),
)
+ def simple_lbl(self):
+ values = [unicode(getattr(self, attr)) for attr in ('surname', 'name')
+ if getattr(self, attr)]
+ if not values and self.raw_name:
+ values = [self.raw_name]
+ return u" ".join(values)
+
def __unicode__(self):
values = [unicode(getattr(self, attr)) for attr in ('surname', 'name')
if getattr(self, attr)]
diff --git a/ishtar_common/templates/ishtar/blocks/window_field.html b/ishtar_common/templates/ishtar/blocks/window_field.html
index bca32225c..14cf1c21e 100644
--- a/ishtar_common/templates/ishtar/blocks/window_field.html
+++ b/ishtar_common/templates/ishtar/blocks/window_field.html
@@ -1,3 +1,3 @@
{% load i18n %}
{% if data %}<p><label>{% trans caption %}{% trans ":"%}</label>
-<span class='value'>{{pre_data|safe}}{{data}}{{post_data|safe}}</span></p>{% endif%}
+<span class='value'>{{pre_data|safe}}{{data|linebreaksbr}}{{post_data|safe}}</span></p>{% endif%}