Skip to content

Commit

Permalink
Merge pull request #489 from omerxx/430-csv-name
Browse files Browse the repository at this point in the history
Fix PR #462 which is a fix for #430 - change downloaded csv name
  • Loading branch information
danielhers committed Nov 20, 2015
2 parents cce68e1 + bc7f793 commit 22f16ea
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 22f16ea

Please sign in to comment.