templates with flying team name containing unicode characters crash
ERROR 2018-09-03 11:14:48,507 exception 11764 140131621689088 Internal Server Error: /mail_templates/5/generate/31810
Traceback (most recent call last):
File "/var/www/scheduling-system/env/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 42, in inner
response = get_response(request)
File "/var/www/scheduling-system/env/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/var/www/scheduling-system/env/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/var/www/scheduling-system/smash/web/views/mails.py", line 74, in generate
stream = mail_template.apply(instance, request.user, stream)
File "/var/www/scheduling-system/smash/web/models/mail_template.py", line 153, in apply
self._add_appointment_replacements(replacements, appointment)
File "/var/www/scheduling-system/smash/web/models/mail_template.py", line 188, in _add_appointment_replacements
"##A_FLYING_TEAM##": str(appointment.flying_team),
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in position 2: ordinal not in range(128)