Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(12)  |  Call(8)  |  Derive(0)  |  Import(4)

        def make_csv_response(data=[], filename='export.csv'):
    """
    Create a HTTP response for downloading a CSV file with provided data.

    :param data - list of rows of data
    :param filename - the name of the file to be downloaded

    How to use:
    >>> rows = [
    ...    ['CAR', 'COLOR'],
    ...    ['Ford', 'Red'],
    ...    ['BMW', 'Black'],
    ...]
    >>> response = make_csv_response(data=rows, filename='myfile.csv')
    """

    f = cStringIO.StringIO()
    UnicodeWriter(f).writerows((unicode(item) for item in row) for row in data)
    response = HttpResponse(f.getvalue(), content_type='application/csv')
    disposition = 'attachment; filename=%s' % filename
    response['Content-Disposition'] = disposition
    return response
        


src/r/a/ralph-1.2.9/src/ralph/ui/views/reports.py   ralph(Download)
 
from bob.menu import MenuItem
from bob.csvutil import make_csv_response
from dj.choices import Choices
import django_rq
            self.venture_data is not None):
            return make_csv_response(
                data=self.export_csv(self.venture_data, self.extra_types),
                filename='ReportVentures.csv',
            )
            rows.insert(0, headers)
            return make_csv_response(
                data=rows,
                filename=csv_conf.get('name'),
            )
                )
                return make_csv_response(
                    data=self.get_csv_data(self.devices),
                    filename=filename,
                )
                )
                return make_csv_response(
                    data=self.get_csv_data(self.devices),
                    filename=filename,
                )

src/d/j/django-bob-1.6.0/bob/data_table.py   django-bob(Download)
    def make_csv_response(self, data):
        return csvutil.make_csv_response(
            data=data, filename=self.csv_file_name)
 
    def do_csv_export(self, queryset):

src/r/a/ralph_pricing-HEAD/src/ralph_pricing/views/statement.py   ralph_pricing(Download)
import json
 
from bob.csvutil import make_csv_response
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
        if self.request.GET.get('format', '').lower() == 'csv':
            return make_csv_response(
                itertools.chain(self.header, self.data),
                '{}.csv'.format(self.section),
            )

src/r/a/ralph_pricing-HEAD/src/ralph_pricing/views/reports.py   ralph_pricing(Download)
from ralph_pricing.models import Statement
from ralph_pricing.views.base import Base
from bob.csvutil import make_csv_response
import django_rq
from rq.job import Job
                        self._format_csv_header()
                        return make_csv_response(
                            itertools.chain(self.header, self.data),
                            '{}.csv'.format(self.section),
                        )

src/r/a/ralph_pricing-1.2.8/src/ralph_pricing/views/reports.py   ralph_pricing(Download)
 
from ralph_pricing.views.base import Base
from bob.csvutil import make_csv_response
import django_rq
from rq.job import Job
                    if self.progress == 100:
                        return make_csv_response(
                            itertools.chain([self.header], self.data),
                            '{}.csv'.format(self.section),
                        )