From f008a4eb0a9948ad6eda0c61ca7d7ca8c8960028 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Fri, 10 Aug 2012 11:18:01 +0200 Subject: [PATCH] use OpenSlides.get_full_name instead of OpenSlides.user.get_full_name --- openslides/participant/models.py | 7 +++++-- openslides/participant/tests.py | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/openslides/participant/models.py b/openslides/participant/models.py index ae8a33f40..39b0da215 100644 --- a/openslides/participant/models.py +++ b/openslides/participant/models.py @@ -74,6 +74,9 @@ class OpenSlidesUser(models.Model, PersonMixin): first_name = property(get_first_name, set_first_name) + def get_full_name(self): + return "%s %s" % self.first_name, self.last_name + def get_last_name(self): return self.user.last_name @@ -114,8 +117,8 @@ class OpenSlidesUser(models.Model, PersonMixin): def __unicode__(self): if self.name_surfix: - return "%s (%s)" % (self.user.get_full_name(), self.name_surfix) - return "%s" % self.user.get_full_name() + return u"%s (%s)" % (self.get_full_name(), self.name_surfix) + return u"%s" % self.get_full_name() def save(self, *args, **kwargs): if self.save_user_object: diff --git a/openslides/participant/tests.py b/openslides/participant/tests.py index a64f4ea54..e8fcff2b7 100644 --- a/openslides/participant/tests.py +++ b/openslides/participant/tests.py @@ -66,6 +66,7 @@ class OpenSlidesUserTest(TestCase): user1 = User.objects.get(pk=1) self.assertEqual(user1.first_name, 'foo') self.assertEqual(user1.last_name, 'bar') + self.assertEqual(user1.get_full_name(), 'foo bar') class OpenSlidesGroupTest(TestCase):