symposion_app/symposion/speakers/management/commands/export_speaker_data.py
Carlos Henrique Romano 36ab6d599f Fix flake8 warnings
2014-07-30 15:19:26 -03:00

19 lines
511 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):
csv_file = csv.writer(open(os.path.join(os.getcwd(), "speakers.csv"), "wb"))
csv_file.writerow(["Name", "Bio"])
for speaker in Speaker.objects.all():
csv_file.writerow([
speaker.name.encode("utf-8"),
speaker.biography.encode("utf-8"),
])