symposion_app/symposion/speakers/management/commands/export_speaker_data.py
Sachi King 298b162be6 Flake8 Fixes
Mostly whitespace fixes
Some unicode fixes
Fixed up CSV writer.  str is not bytes and all.
2017-04-17 22:51:48 +10:00

20 lines
547 B
Python

import csv
import os
from django.core.management.base import BaseCommand
from symposion.speakers.models import Speaker
class Command(BaseCommand):
def handle(self, *args, **options):
with open(os.path.join(os.getcwd(), "speakers.csv"), "w") as csv_file:
csv_writer = csv.writer(csv_file)
csv_writer.writerow(["Name", "Bio"])
for speaker in Speaker.objects.all():
csv_writer.writerow([
speaker.name,
speaker.biography,
])