CSV fixes

This commit is contained in:
Christopher Neugebauer 2016-10-14 11:19:10 -07:00
parent 2637930996
commit 517da70536
2 changed files with 4 additions and 4 deletions

View file

@ -289,12 +289,12 @@ class ReportView(object):
# Create the HttpResponse object with the appropriate CSV header.
response = HttpResponse(content_type='text/csv')
#response['Content-Disposition'] = 'attachment; filename="somefilename.csv"'
writer = csv.writer(response)
writer.writerow(list(report.headings()))
encode = lambda i: i.encode("utf8") if isinstance(i, unicode) else i
writer.writerow(list(encode(i) for i in report.headings()))
for row in report.rows():
writer.writerow(list(row))
writer.writerow(list(encode(i) for i in row))
return response

View file

@ -408,7 +408,7 @@ def attendee(request, form, user_id=None):
''' Returns a list of all manifested attendees if no attendee is specified,
else displays the attendee manifest. '''
if user_id is None and not form.has_changed():
if user_id is None:
return attendee_list(request)
if form.cleaned_data["user"] is not None: