Fix data type/size issue with CSV download

This commit is contained in:
Lance Edgar 2017-09-16 18:42:18 -05:00
parent c497604a30
commit 8d78fad621

View file

@ -1398,9 +1398,9 @@ class MasterView(View):
for obj in results:
writer.writerow(self.get_csv_row(obj, fields))
response = self.request.response
response.text = data.getvalue().decode('utf_8')
response.body = data.getvalue()
data.close()
response.content_length = len(response.text)
response.content_length = len(response.body)
response.content_type = b'text/csv'
response.content_disposition = b'attachment; filename={}.csv'.format(self.get_grid_key())
return response