]> git.0d.be Git - django-panik-nonstop.git/commitdiff
stop encoding csv exports
authorFrédéric Péters <fpeters@0d.be>
Mon, 3 Feb 2020 14:16:51 +0000 (15:16 +0100)
committerFrédéric Péters <fpeters@0d.be>
Mon, 3 Feb 2020 14:17:53 +0000 (15:17 +0100)
nonstop/views.py

index b6480eee845a4bf3670ed4ccbbe44ba67a53b5fe..937a8cb08ebc260cb4496867dc0f6fe3ff52fd05 100644 (file)
@@ -42,9 +42,9 @@ class SomaDayArchiveCsvView(SomaDayArchiveView):
         for line in context['object_list']:
             if line.filepath.track:
                 writer.writerow([line.play_timestamp.strftime('%Y-%m-%d %H:%M'),
-                    line.filepath.short.encode('utf-8', 'replace'),
-                    line.filepath.track.title.encode('utf-8', 'replace'),
-                    line.filepath.track.artist.name.encode('utf-8', 'replace'),
+                    line.filepath.short,
+                    line.filepath.track.title,
+                    line.filepath.track.artist.name,
                     line.filepath.track.language,
                     line.filepath.track.instru and 'instru' or '',
                     line.filepath.track.cfwb and 'cfwb' or '',
@@ -52,7 +52,7 @@ class SomaDayArchiveCsvView(SomaDayArchiveView):
                     ])
             else:
                 writer.writerow([line.play_timestamp.strftime('%Y-%m-%d %H:%M'),
-                                line.filepath.short.encode('utf-8', 'replace')])
+                                line.filepath.short])
         return HttpResponse(out.getvalue(), content_type='text/csv; charset=utf-8')
 
 
@@ -308,9 +308,9 @@ class SearchCsvView(SearchView):
         writer.writerow(['Title', 'Artist', 'Zones', 'Language', 'Instru', 'CFWB', 'Ajout'])
         for track in self.get_queryset():
             writer.writerow([
-                track.title.encode('utf-8', 'replace') if track.title else 'Inconnu',
-                track.artist.name.encode('utf-8', 'replace') if (track.artist and track.artist.name) else 'Inconnu',
-                ' + '.join([x.title.encode('utf-8') for x in track.nonstop_zones.all()]),
+                track.title if track.title else 'Inconnu',
+                track.artist.name if (track.artist and track.artist.name) else 'Inconnu',
+                ' + '.join([x.title for x in track.nonstop_zones.all()]),
                 track.language or '',
                 track.instru and 'instru' or '',
                 track.cfwb and 'cfwb' or '',