Skip to content

Commit

Permalink
feat: permanently enable streaming csv
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammad-ammar committed Feb 15, 2024
1 parent bb2fa8b commit 28236f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Unreleased
----------

=========================
[6.1.0] - 2024-02-15
---------------------
* Permanently enable streaming csv

[6.0.0] - 2024-02-13
---------------------
* Add streaming csv support
Expand Down
2 changes: 1 addition & 1 deletion enterprise_data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Enterprise data api application. This Django app exposes API endpoints used by enterprises.
"""

__version__ = "6.0.0"
__version__ = "6.1.0"
13 changes: 6 additions & 7 deletions enterprise_data/api/v1/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,12 @@ def list(self, request, *args, **kwargs):
"""
Override the list method to handle streaming CSV download.
"""
if self.request.query_params.get('streaming_csv_enabled') == 'true':
if request.accepted_renderer.format == 'csv':
return StreamingHttpResponse(
EnrollmentsCSVRenderer().render(self._stream_serialized_data()),
content_type="text/csv",
headers={"Content-Disposition": 'attachment; filename="learner_progress_report.csv"'},
)
if request.accepted_renderer.format == 'csv':
return StreamingHttpResponse(
EnrollmentsCSVRenderer().render(self._stream_serialized_data()),
content_type="text/csv",
headers={"Content-Disposition": 'attachment; filename="learner_progress_report.csv"'},
)

return super().list(request, *args, **kwargs)

Expand Down

0 comments on commit 28236f7

Please sign in to comment.