summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2014-12-28 01:15:07 +0100
committerÉtienne Loks <etienne.loks@proxience.com>2015-05-06 15:38:32 +0200
commit3b557c928dc57942d4e9496b7730504bc44ad1eb (patch)
treecf7782840ce79aee720cf3b6c55571ab0b2e7c8e /ishtar_common/models.py
parent16fbb32b8ba00325a7b813825f288cb097699c98 (diff)
downloadIshtar-3b557c928dc57942d4e9496b7730504bc44ad1eb.tar.bz2
Ishtar-3b557c928dc57942d4e9496b7730504bc44ad1eb.zip
Work on dynamic (too much of ajax and JS...) person/organization widget
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py12
1 files changed, 9 insertions, 3 deletions
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]