Commit b87634d8 by Peter Pinch

Merge pull request #10268 from mitocw/fix/pdw/download-ccx-csv

Fix CCX grades csv file download
parents d4f2fe12 5562f8ea
......@@ -247,4 +247,5 @@ George Schneeloch <gschneel@mit.edu>
Dustin Gadal <Dustin.Gadal@gmail.com>
Robert Raposa <rraposa@edx.org>
Giovanni Di Milia <gdimilia@mit.edu>
Justin Abrahms <abrahms@mit.edu>
\ No newline at end of file
Peter Wilkins <pwilkins@mit.edu>
Justin Abrahms <abrahms@mit.edu>
......@@ -733,6 +733,12 @@ class TestCCXGrades(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
)
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
# Are the grades downloaded as an attachment?
self.assertEqual(
response['content-disposition'],
'attachment'
)
headers, row = (
row.strip().split(',') for row in
response.content.strip().split('\n')
......
......@@ -615,4 +615,7 @@ def ccx_grades_csv(request, course, ccx=None):
for row in rows:
writer.writerow(row)
return HttpResponse(buf.getvalue(), content_type='text/plain')
response = HttpResponse(buf.getvalue(), content_type='text/csv')
response['Content-Disposition'] = 'attachment'
return response
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment