Commits

Shinya Okano committed 6c2ddaf

errorsの処理でNoneが入る問題の修正

Comments (0)

Files changed (1)

csvutils/admin.py

 class ExportCSVAction(object):
     short_description = _('Export to CSV')
 
-    def __init__(self, encoding=None):
+    def __init__(self, encoding=None, errors=None):
         self.encoding = encoding or settings.DEFAULT_CHARSET
+        self.errors = errors or 'replace'
 
     @property
     def __name__(self):
             if ld[0] == 'action_checkbox':
                 del ld[0]
             fields = ld
-        return queryset_to_csv(queryset, fields, encoding=self.encoding,
+        return queryset_to_csv(queryset, fields, encoding=self.encoding, errors=self.errors,
                 filename='%s.csv' % slugify(modeladmin.model.__name__))
 
 export_csv = ExportCSVAction()