Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue 430 - Change downloaded CSV filename to a meaningful name… #462

Closed
wants to merge 1 commit into from

Conversation

kilaka
Copy link
Collaborator

@kilaka kilaka commented Oct 12, 2015

Fixed issue #430 - Change downloaded CSV filename to a meaningful name. Example:
Anyway-accidents-from-2012-01-31-to-2015-10-12.csv

…. Example:

Anyway-accidents-from-2012-01-31-to-2015-10-12.csv
@@ -139,7 +139,7 @@ def markers():
if request.values.get('format') == 'csv':
return Response(generate_csv(accidents), headers={
"Content-Type": "text/csv",
"Content-Disposition": 'attachment; filename="data.csv"'
"Content-Disposition": 'attachment; filename="Anyway-accidents-from-'+kwargs['start_date'].strftime('%Y-%m-%d')+'-to-'+kwargs['end_date'].strftime('%Y-%m-%d')+'.csv"'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a big deal but in this case I would

  1. extract the format specifier %Y-%m-%d to a variable
  2. use format rather than concatenating strings

Also, you should use a # before the issue number in the commit message, so GitHub will know to automatically associate it (and also close it if you say "fixed" in the message).

@danielhers danielhers deployed to anyway-unstable-pr-462 October 13, 2015 14:13 Active
@danielhers
Copy link
Collaborator

@kilaka please fix and I'll merge.

@danielhers danielhers force-pushed the dev branch 2 times, most recently from a6f1b00 to 73754d4 Compare November 3, 2015 10:09
omerxx added a commit to omerxx/anyway that referenced this pull request Nov 20, 2015
danielhers added a commit that referenced this pull request Nov 20, 2015
Fix PR #462 which is a fix for #430 - change downloaded csv name
@danielhers danielhers closed this Nov 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants