Mercurial > kallithea
diff rhodecode/model/db.py @ 1950:4ae17f819ee8 beta
#344 optional firstname lastname on user creation
- on display fallback to username if both empty
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 27 Jan 2012 04:46:00 +0200 |
parents | 4582e6b9e2f6 |
children | 7e4b3d3a9c5c |
line wrap: on
line diff
--- a/rhodecode/model/db.py Fri Jan 27 04:14:01 2012 +0200 +++ b/rhodecode/model/db.py Fri Jan 27 04:46:00 2012 +0200 @@ -299,6 +299,11 @@ return '%s %s' % (self.name, self.lastname) @property + def full_name_or_username(self): + return ('%s %s' % (self.name, self.lastname) + if (self.name and self.lastname) else self.username) + + @property def full_contact(self): return '%s %s <%s>' % (self.name, self.lastname, self.email) @@ -354,8 +359,13 @@ log.debug('updated user %s lastlogin', self.username) def __json__(self): - return dict(email=self.email, - full_name=self.full_name) + return dict( + email=self.email, + full_name=self.full_name, + full_name_or_username=self.full_name_or_username, + short_contact=self.short_contact, + full_contact=self.full_contact + ) class UserLog(Base, BaseModel):