From 94e8b2a685906e14e57dacc3b536b2a28dbac19a Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 1 Apr 2016 15:38:53 +0100 Subject: [PATCH] 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. --- app/main/views/send.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/main/views/send.py b/app/main/views/send.py index 976e87f43..6c30a43b1 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -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//send//to-self", methods=['GET'])