Skip to content

Commit

Permalink
Fix PR data-for-change#462 which is a fix for data-for-change#430 - c…
Browse files Browse the repository at this point in the history
…hange downloaded csv name
  • Loading branch information
omerxx committed Nov 20, 2015
1 parent e0dbef8 commit bc7f793
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,12 @@ def markers():
discussions = DiscussionMarker.bounding_box_query(**{arg: kwargs[arg] for arg in discussion_args})

if request.values.get('format') == 'csv':
date_format = '%Y-%m-%d'
return Response(generate_csv(accidents), headers={
"Content-Type": "text/csv",
"Content-Disposition": 'attachment; filename="data.csv"'
"Content-Disposition": 'attachment; '
'filename="Anyway-accidents-from-{0}-to{1}.csv"'
.format(kwargs["start_date"].strftime(date_format), kwargs["end_date"].strftime(date_format))
})

else: # defaults to json
Expand Down

0 comments on commit bc7f793

Please sign in to comment.