use OpenSlides.get_full_name instead of OpenSlides.user.get_full_name

This commit is contained in:
Oskar Hahn 2012-08-10 11:18:01 +02:00
parent 153482f32d
commit f008a4eb0a
2 changed files with 6 additions and 2 deletions

View File

@ -74,6 +74,9 @@ class OpenSlidesUser(models.Model, PersonMixin):
first_name = property(get_first_name, set_first_name) 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): def get_last_name(self):
return self.user.last_name return self.user.last_name
@ -114,8 +117,8 @@ class OpenSlidesUser(models.Model, PersonMixin):
def __unicode__(self): def __unicode__(self):
if self.name_surfix: if self.name_surfix:
return "%s (%s)" % (self.user.get_full_name(), self.name_surfix) return u"%s (%s)" % (self.get_full_name(), self.name_surfix)
return "%s" % self.user.get_full_name() return u"%s" % self.get_full_name()
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
if self.save_user_object: if self.save_user_object:

View File

@ -66,6 +66,7 @@ class OpenSlidesUserTest(TestCase):
user1 = User.objects.get(pk=1) user1 = User.objects.get(pk=1)
self.assertEqual(user1.first_name, 'foo') self.assertEqual(user1.first_name, 'foo')
self.assertEqual(user1.last_name, 'bar') self.assertEqual(user1.last_name, 'bar')
self.assertEqual(user1.get_full_name(), 'foo bar')
class OpenSlidesGroupTest(TestCase): class OpenSlidesGroupTest(TestCase):