# Generated by Django 3.1.2 on 2020-11-21 08:13

from django.db import migrations
import csv

def loadCourses(apps, schema_editor):
    Course = apps.get_model('api', 'Course')
    with open("allCourseData.csv", 'r') as subjects:
        csvreader = csv.reader(subjects)
        fields = next(csvreader)

        for row in csvreader:
            course = Course(department = row[1], number = row[2], name = row[3])
            course.save()

class Migration(migrations.Migration):

    dependencies = [
        ('api', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(loadCourses),
    ]
