@ -120,6 +120,15 @@ class Group(models.Model):
else :
else :
return " "
return " "
def has_age_info ( self ) :
return self . year_from and self . year_to
def get_age_info ( self ) :
if self . has_age_info ( ) :
return _ ( " years %(from)s to %(to)s " ) % { ' from ' : self . year_from , ' to ' : self . year_to }
else :
return " "
def get_invitation_text_template ( self ) :
def get_invitation_text_template ( self ) :
""" The text template used to invite waiters to this group. This contains
""" The text template used to invite waiters to this group. This contains
placeholders for the name of the waiter and personalized links . """
placeholders for the name of the waiter and personalized links . """
@ -131,8 +140,14 @@ class Group(models.Model):
group_time = self . get_time_info ( )
group_time = self . get_time_info ( )
else :
else :
group_time = settings . GROUP_TIME_UNAVAILABLE_TEXT . format ( contact_email = self . contact_email )
group_time = settings . GROUP_TIME_UNAVAILABLE_TEXT . format ( contact_email = self . contact_email )
if self . has_age_info ( ) :
group_age = self . get_age_info ( )
else :
group_age = _ ( " no information available " )
return settings . INVITE_TEXT . format ( group_time = group_time ,
return settings . INVITE_TEXT . format ( group_time = group_time ,
group_name = self . name ,
group_name = self . name ,
group_age = group_age ,
group_link = group_link ,
group_link = group_link ,
contact_email = self . contact_email )
contact_email = self . contact_email )