def handle(self, *args, **options): writer = csv.writer(self.stdout) header_row = DataExport.report_mailchimp_header_row() writer.writerow(header_row) for row in DataExport.report_mailchimp(): writer.writerow(row) self.stderr.write(self.style.SUCCESS('Successfully generated report'))
def handle(self, *args, **options): writer = csv.writer(self.stdout) writer.writerow(DataExport.report_churn_header_row()) for row in DataExport.report_churn(): writer.writerow(row) self.stderr.write(self.style.SUCCESS('Successfully generated report'))
def db_report(request): response = HttpResponse(content_type='text/csv') response['Content-Disposition'] = 'attachment; filename="db.csv"' writer = csv.writer(response) header_row = DataExport.report_db_header_row() writer.writerow(header_row) for row in DataExport.report_db(): writer.writerow(row) return response
def churn_report(request): response = HttpResponse(content_type='text/csv') response['Content-Disposition'] = 'attachment; filename="churn.csv"' writer = csv.writer(response) for row in DataExport.report_churn(): writer.writerow(row) return response