diff options
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 9aaf7bab1..a6fc8722d 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2670,6 +2670,9 @@ class UserProfile(models.Model): verbose_name = _(u"User profile") verbose_name_plural = _(u"User profiles") + def __unicode__(self): + return unicode(self.profile_type) + class IshtarUser(FullSearch): TABLE_COLS = ('username', 'person__name', 'person__surname', @@ -2706,6 +2709,17 @@ class IshtarUser(FullSearch): def __unicode__(self): return unicode(self.person) + @property + def current_profile_name(self): + q = UserProfile.objects.filter(current=True, person__ishtaruser=self) + if q.count(): + return q.values('profile_type__label').all()[0][ + 'profile_type__label'] + profile = self.person.current_profile + if not profile: + return u"" + return unicode(profile) + @classmethod def set_superuser(cls, user): q = cls.objects.filter(user_ptr=user) |