From 086cb36acde4343f5e4dc8dc18a70cdbd8512c33 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sun, 28 Dec 2014 01:15:07 +0100 Subject: Work on dynamic (too much of ajax and JS...) person/organization widget --- ishtar_common/models.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'ishtar_common/models.py') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 23c2f3ac7..fe907f014 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1540,10 +1540,13 @@ class Person(Address, Merge, OwnPerms, ValueGetter) : values = [unicode(getattr(self, attr)) for attr in ('surname', 'name') if getattr(self, attr)] - if not values: - values = [self.raw_name or ""] + if not values and self.raw_name: + values = [self.raw_name] if self.attached_to: - values.append(u"- " + unicode(self.attached_to)) + attached_to = unicode(self.attached_to) + if values: + values.append(u'-') + values.append(attached_to) return u" ".join(values) def get_values(self, prefix=''): @@ -1577,6 +1580,9 @@ class Person(Address, Merge, OwnPerms, ValueGetter) : self.merge_key += "-" + self.attached_to.merge_key self.merge_key = self.merge_key[:300] + def is_natural(self): + return not self.attached_to + def has_right(self, right_name): if '.' in right_name: right_name = right_name.split('.')[-1] -- cgit v1.2.3