Show organization's and root organization's name in position's full title

This commit is contained in:
Cédric Messiant 2013-10-08 15:10:55 +02:00
parent 75fdb304ea
commit 665aaf9c05
2 changed files with 12 additions and 4 deletions

View File

@ -69,10 +69,18 @@ class Position(Container):
def get_full_title(self):
"""Returns the full title of the position
It is constituted by the name of the position and
the name of its organization in brackets
It is constituted by the name of the position,
the name of its organization and the name of the
root organization in brackets.
"""
return u"%s (%s)" % (self.title, self.get_organization().title)
organization = self.get_organization()
root_organization = organization.get_root_organization()
if organization == root_organization:
return u"%s (%s)" % (self.title, organization.title)
else:
return u"%s, %s (%s)" % (self.title, organization.title,
root_organization.title)
def get_held_positions(self):
"""Returns the held position

View File

@ -159,7 +159,7 @@ class TestPosition(TestContentTypes):
self.assertEqual(self.general_adt.get_full_title(),
u"Général de l'armée de terre (Armée de terre)")
self.assertEqual(self.sergent_lh.get_full_title(),
u"Sergent de la brigade LH (Brigade LH)")
u"Sergent de la brigade LH, Brigade LH (Armée de terre)")
class TestHeldPosition(TestContentTypes):