def handle(self, *args, **options): channel = Channel.objects.get(pk=options['channel_id']) logging.info("Writing CSV for {}".format(channel.name)) csv_path = write_channel_csv_file(channel, force=options['force'], show_progress=True) logging.info("\n\nFinished writing to CSV at {}\n\n".format(csv_path))
def generatechannelcsv_task(channel_id, domain, user_id): channel = Channel.objects.get(pk=channel_id) user = User.objects.get(pk=user_id) csv_path = write_channel_csv_file(channel, site=domain) subject = render_to_string('export/csv_email_subject.txt', {'channel': channel}) message = render_to_string('export/csv_email.txt', {'channel': channel, 'user': user}) email = EmailMessage(subject, message, settings.DEFAULT_FROM_EMAIL, [user.email]) email.attach_file(csv_path) email.send()
def generatechannelcsv_task(channel_id, domain, user_id): channel = Channel.objects.get(pk=channel_id) user = User.objects.get(pk=user_id) csv_path = write_channel_csv_file(channel, site=domain) subject = render_to_string("export/csv_email_subject.txt", {"channel": channel}) message = render_to_string( "export/csv_email.txt", {"channel": channel, "user": user} ) email = EmailMessage(subject, message, settings.DEFAULT_FROM_EMAIL, [user.email]) email.attach_file(csv_path) email.send()