def __init__(self, rows: list, filename: str, dialect='excel', **kw):
        """
        Returns CSV response.
        :param rows: List of column lists
        :param filename: Download response file name
        :param dialect: csv.writer dialect
        :param kw: Parameters to be passed to HttpResponse __init__
        """
        import csv

        f = StringIO()
        writer = csv.writer(f, dialect=dialect)
        for row in rows:
            writer.writerow(row)

        buf = f.getvalue().encode('utf-8')
        super().__init__(content=buf, content_type='text/csv', **kw)
        self['Content-Disposition'] = 'attachment;filename="{0}"'.format(filename)
def __init__ ( self , rows : list , filename : str , dialect = 'excel' , ** kw ) : import csv f = StringIO ( ) writer = csv . writer ( f , dialect = dialect ) for row in rows : writer . writerow ( row ) buf = f . getvalue ( ) . encode ( 'utf-8' ) super ( ) . __init__ ( content = buf , content_type = 'text/csv' , ** kw ) self [ 'Content-Disposition' ] = 'attachment;filename="{0}"' . format ( filename )
Returns CSV response.
        :param rows: List of column lists
        :param filename: Download response file name
        :param dialect: csv.writer dialect
        :param kw: Parameters to be passed to HttpResponse __init__