Skip to content
Snippets Groups Projects
Commit 920480a4 authored by Dylan Sechet's avatar Dylan Sechet
Browse files

Added utf-8 support to exported csv and switched delimiter from , to ; in admin interface

parent 282e84e4
Branches
No related tags found
14 merge requests!58Hamza,!52Hamza,!54Add field "en attentes" in participations options,!51Hamza,!48Hamza,!45Hamza,!40Solve public permission files on AWS,!36Notifications for Sec-Gen,!34Dev-> Master (ordering students by updated_date, school filter, export_csv for visits),!31Sorties,!24Amélioration de l'interface admin,!28Updated student admin filters,!27Better filtering for registration,!26merge dev into master
......@@ -2,6 +2,7 @@
from django.contrib import admin
from .models import Student, Tutor
import codecs
import csv
from django.http import HttpResponse
......@@ -13,7 +14,8 @@ class ExportCsvMixin:
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename={}.csv'.format(meta)
writer = csv.writer(response)
response.write(codecs.BOM_UTF8) #force response to be UTF-8
writer = csv.writer(response, delimiter=';')
writer.writerow(field_names)
for obj in queryset:
......@@ -21,7 +23,7 @@ class ExportCsvMixin:
return response
export_as_csv.short_description = "Export Selected"
export_as_csv.short_description = "Exporter sélection (en .csv)"
class ProfileAdminMixin:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment