diff --git a/smash/web/models/mail_template.py b/smash/web/models/mail_template.py index 50739c4b14faf152d6fc445b5d1bf11f718ffc64..575a3c2a8a24bcaef50d0d46aedb216c3f6e345d 100644 --- a/smash/web/models/mail_template.py +++ b/smash/web/models/mail_template.py @@ -231,10 +231,10 @@ class MailTemplate(models.Model): "##A_DATE_FULL##": appointment_date_full, "##A_DATE_SHORT##": appointment_date_short, "##A_TIME##": appointment_date_time, - "##A_FLYING_TEAM##": str(appointment.flying_team), + "##A_FLYING_TEAM##": unicode(appointment.flying_team), "##A_STATUS##": appointment.get_status_display(), "##A_LOCATION##": appointment.location.name, - "##A_LOCATION_OR_FLYINGTEAM##": str(appointment.flying_team) or appointment.location.name, + "##A_LOCATION_OR_FLYINGTEAM##": unicode(appointment.flying_team) or appointment.location.name, "##A_WORKER##": unicode(appointment.worker_assigned), '##A_WORKER_PHONE##': worker_phone_number, '##A_WORKER_EMAIL##': worker_email_address, diff --git a/smash/web/templates/_base.html b/smash/web/templates/_base.html index 829e2a6499ef3450d5735ac375b8d9f2c30a54fd..4456a55306092d0d9371e50b4866521d1b72ecf3 100644 --- a/smash/web/templates/_base.html +++ b/smash/web/templates/_base.html @@ -267,7 +267,7 @@ desired effect {% block footer %} <!-- To the right --> <div class="pull-right hidden-xs"> - Version: <strong>0.11.2</strong> (4 May 2018) + Version: <strong>0.11.3</strong> (3 Sep 2018) </div> <!-- Default to the left --> diff --git a/smash/web/tests/models/test_mail_template.py b/smash/web/tests/models/test_mail_template.py index 0171459e4cdfcc835772fc4e568b2e8f13479703..b2ff16dad3b8f230ff5ab7a9feebc7e8c28e5066 100644 --- a/smash/web/tests/models/test_mail_template.py +++ b/smash/web/tests/models/test_mail_template.py @@ -1,3 +1,4 @@ +# coding=utf-8 import StringIO from django.test import TestCase @@ -9,7 +10,7 @@ from web.models.constants import MAIL_TEMPLATE_CONTEXT_APPOINTMENT, MAIL_TEMPLAT from web.models.mail_template import DATE_FORMAT_SHORT from web.tests.functions import create_language, get_resource_path, create_appointment, create_user, \ create_study_subject, \ - create_visit, create_voucher, create_worker + create_visit, create_voucher, create_worker, create_flying_team class MailTemplateModelTests(TestCase): @@ -84,6 +85,20 @@ class MailTemplateModelTests(TestCase): location = appointment.location.name self.check_doc_contains(doc, [worker_name, location]) + def test_appointment_with_unicode_flying_team(self): + template_name_french = "test_fr" + appointment = create_appointment() + # noinspection PyNonAsciiChar + flying_team_name = u"Liège" + appointment.flying_team = create_flying_team(flying_team_name) + appointment_template_french = MailTemplate(name=template_name_french, language=self.french_language, + context=MAIL_TEMPLATE_CONTEXT_APPOINTMENT, + template_file=self.template_file) + stream = StringIO.StringIO() + appointment_template_french.apply(appointment, self.user, stream) + doc = Document(stream) + self.check_doc_contains(doc, [flying_team_name]) + def test_apply_subject(self): template_name_french = "test_fr" subject = create_study_subject()