summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-04-09 20:22:12 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-06-12 08:39:42 +0200
commit478bef4100f4b18553a74e79fbacc2ffec695d7c (patch)
tree26d66e9387005a4e7b047b1bd9a2a6542856076d /ishtar_common/models.py
parenteada3318b5244c9556314f1f68012260e7b95d22 (diff)
downloadIshtar-478bef4100f4b18553a74e79fbacc2ffec695d7c.tar.bz2
Ishtar-478bef4100f4b18553a74e79fbacc2ffec695d7c.zip
Add a profile page to manage preferences (refs #4046)
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py14
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)