Fix example CSV for email templates

It should populate the CSV file with the user’s email address, not their phone
number.
This commit is contained in:
Chris Hill-Scott
2016-02-25 17:16:02 +00:00
parent a51d92c87a
commit 70ef2f5a6f

View File

@@ -105,7 +105,12 @@ def get_example_csv(service_id, template_id):
output = io.StringIO()
writer = csv.writer(output)
writer.writerow(['to'] + placeholders)
writer.writerow([current_user.mobile_number] + ["test {}".format(header) for header in placeholders])
writer.writerow([
{
'email': current_user.email_address,
'sms': current_user.mobile_number
}[template['template_type']]
] + ["test {}".format(header) for header in placeholders])
return output.getvalue(), 200, {'Content-Type': 'text/csv; charset=utf-8'}