def some_view(request):
cursor = connection.cursor()
cursor.execute("SELECT * FROM helpdesk_task WHERE executor_id = 2232")
row = cursor.fetchall()
response = HttpResponse(mimetype='text/csv')
response['Content-Disposition'] = 'attachment; filename=unruly.csv'
writer = csv.writer(response, dialect="excel-tab")
writer.writerow(['Year', 'Unruly Airline Passengers'])
for (year) in zip(row):
writer.writerow([year])
return response
Файл формируется, но в таком виде:
((307, 796, u'\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u043d\u0430 \u043b\u0435\u0442\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438', datetime.datetime(2009, 3, 30, 18, 0), datetime.datetime(2009, 3, 30, 10, 21, 26, 241000), u'', u'', 2232, 6, datetime.datetime(2009, 3, 30, 10, 21, 26, 241000), datetime.datetime(2009, 3, 30, 17, 11, 53, 271000)),)
Не могу понять, как ее изменить эту кодировку??