Fix data type/size issue with CSV download
This commit is contained in:
parent
c497604a30
commit
8d78fad621
|
@ -1398,9 +1398,9 @@ class MasterView(View):
|
||||||
for obj in results:
|
for obj in results:
|
||||||
writer.writerow(self.get_csv_row(obj, fields))
|
writer.writerow(self.get_csv_row(obj, fields))
|
||||||
response = self.request.response
|
response = self.request.response
|
||||||
response.text = data.getvalue().decode('utf_8')
|
response.body = data.getvalue()
|
||||||
data.close()
|
data.close()
|
||||||
response.content_length = len(response.text)
|
response.content_length = len(response.body)
|
||||||
response.content_type = b'text/csv'
|
response.content_type = b'text/csv'
|
||||||
response.content_disposition = b'attachment; filename={}.csv'.format(self.get_grid_key())
|
response.content_disposition = b'attachment; filename={}.csv'.format(self.get_grid_key())
|
||||||
return response
|
return response
|
||||||
|
|
Loading…
Reference in a new issue