add delimeter as ; in csv
This commit is contained in:
parent
fef2701ae3
commit
ed2f71c150
|
@ -117,7 +117,7 @@ class DevicesDocumentView(DeviceView):
|
||||||
def generate_post_csv(self, query):
|
def generate_post_csv(self, query):
|
||||||
"""Get device query and put information in csv format."""
|
"""Get device query and put information in csv format."""
|
||||||
data = StringIO()
|
data = StringIO()
|
||||||
cw = csv.writer(data)
|
cw = csv.writer(data, delimiter=';', quotechar='"')
|
||||||
first = True
|
first = True
|
||||||
for device in query:
|
for device in query:
|
||||||
d = DeviceRow(device)
|
d = DeviceRow(device)
|
||||||
|
@ -125,7 +125,7 @@ class DevicesDocumentView(DeviceView):
|
||||||
cw.writerow(d.keys())
|
cw.writerow(d.keys())
|
||||||
first = False
|
first = False
|
||||||
cw.writerow(d.values())
|
cw.writerow(d.values())
|
||||||
output = make_response(data.getvalue())
|
output = make_response(data.getvalue().encode('utf-8'))
|
||||||
output.headers['Content-Disposition'] = 'attachment; filename=export.csv'
|
output.headers['Content-Disposition'] = 'attachment; filename=export.csv'
|
||||||
output.headers['Content-type'] = 'text/csv'
|
output.headers['Content-type'] = 'text/csv'
|
||||||
return output
|
return output
|
||||||
|
|
Reference in a new issue