Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion prefix_finder/frontend/templates/download.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<h3> Download Full Data </h3>
<br/>

<p> <a href="{% url 'json_download' %}">JSON: All data in its orignal format.</a></p>
<p> <a href="{% url 'json_download' %}">JSON: All data in its original format.</a></p>
<p> <a href="{% url 'csv_download' %}">CSV: All data in single CSV table.</a></p>
<p> <a href="{% url 'xml_download' %}">XML: Subset of data in the same format as an IATI codelist.</a></p>

Expand Down
8 changes: 4 additions & 4 deletions prefix_finder/frontend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,9 @@ def list_details(request, prefix):
raise Http404('Organisation list {} does not exist'.format(prefix))
return render(request, 'list.html', context={'org_list': org_list, 'branch':use_branch})

def _get_filename():
if git_commit_ref:
return git_commit_ref[:10]
def _get_filename(use_branch='master'):
if git_commit_ref[use_branch]:
return git_commit_ref[use_branch][:10]
else:
return datetime.datetime.now().strftime("%Y%m%d%H%M%S")

Expand Down Expand Up @@ -540,7 +540,7 @@ def csv_download(request):

response = HttpResponse(output.getvalue(), content_type='text/csv')

response['Content-Disposition'] = 'attachment; filename="org-id-{0}.csv"'.format(_get_filename())
response['Content-Disposition'] = 'attachment; filename="org-id-{0}.csv"'.format(_get_filename(use_branch))
return response


Expand Down