generating from mail templates
There is a bug when generating document for flying team:
ERROR 2017-10-04 12:56:58,131 exception 20033 140022577592064 Internal Server Error: /mail_templates/1/generate/30305
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/env/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/var/www/scheduling-system/smash/web/views/mails.py", line 80, in generate
stream = mail_template.apply(instance, request.user, stream)
File "/var/www/scheduling-system/smash/web/models/mail_template.py", line 147, in apply
process_file(self.template_file.path, stream, replacements)
File "/var/www/scheduling-system/smash/web/docx_helper.py", line 15, in process_file
paragraph.text = paragraph.text.replace(placeholder, replacement)
TypeError: coercing to Unicode: need string or buffer, FlyingTeam found
ERROR 2017-10-04 12:57:06,204 exception 20033 140022577592064 Internal Server Error: /mail_templates/1/generate/30305
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/env/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/var/www/scheduling-system/smash/web/views/mails.py", line 80, in generate
stream = mail_template.apply(instance, request.user, stream)
File "/var/www/scheduling-system/smash/web/models/mail_template.py", line 147, in apply
process_file(self.template_file.path, stream, replacements)
File "/var/www/scheduling-system/smash/web/docx_helper.py", line 15, in process_file
paragraph.text = paragraph.text.replace(placeholder, replacement)
TypeError: coercing to Unicode: need string or buffer, FlyingTeam found