Use template name as file name for example CSV

`11.csv` or `9a1d8a7f-c202-43b9-9239-68939d34fec6.csv` is not very friendly.

`Two week reminder.csv` is much nicer.
This commit is contained in:
Chris Hill-Scott
2016-04-01 15:38:53 +01:00
parent f84797e6d5
commit 94e8b2a685

View File

@@ -158,7 +158,10 @@ def get_example_csv(service_id, template_id, number_of_rows=2):
] +
get_example_csv_rows(template, number_of_rows=number_of_rows)
)
return output.getvalue(), 200, {'Content-Type': 'text/csv; charset=utf-8'}
return output.getvalue(), 200, {
'Content-Type': 'text/csv; charset=utf-8',
'Content-Disposition': 'inline; filename="{}.csv"'.format(template.name)
}
@main.route("/services/<service_id>/send/<template_id>/to-self", methods=['GET'])