old_contents: # -*- coding: utf-8 -*-
  # Generated by Django 1.9.2 on 2016-02-10 16:52
  from __future__ import unicode_literals
  
  import ast
  import csv
  import os.path
  
  from django.conf import settings
  from django.db import migrations
  
  from data.models import Variant
  
  
  def load_from_csv(apps, schema_editor):
      file_path = os.path.join(settings.BASE_DIR, 'data', 'resources', 'merged_v5.csv')
      with open(file_path) as csv_file:
          reader = csv.reader(csv_file)
          header = reader.next()
          for row in reader:
              # The first 6 columns of the database are booleans
              for i in range(6):
                  row[i] = ast.literal_eval(row[i])
              Variant.objects.create_variant(dict(zip(header, row)))
  
  
  class Migration(migrations.Migration):
      dependencies = [
          ('data', '0002_search_index'),
      ]
  
      operations = [
          migrations.RunPython(load_from_csv),
      ]
  
new_contents: # -*- coding: utf-8 -*-
  # Generated by Django 1.9.2 on 2016-02-10 16:52
  from __future__ import unicode_literals
  
  import ast
  import csv
  import os.path
  
  from django.conf import settings
  from django.db import migrations
  
  from data.models import Variant
  
  
  def load_from_csv(apps, schema_editor):
      file_path = os.path.join(settings.BASE_DIR, 'data', 'resources', 'merged_v5.csv')
      with open(file_path) as csv_file:
          reader = csv.reader(csv_file)
          header = reader.next()
          source_column = header.index("Source")
          for row in reader:
              # Fill the boolean columns using Source
              for source in row[source_column].split('|'):
                  row['variant_in_'+source] = True
              Variant.objects.create_variant(dict(zip(header, row)))
  
  
  class Migration(migrations.Migration):
      dependencies = [
          ('data', '0002_search_index'),
      ]
  
      operations = [
          migrations.RunPython(load_from_csv),
      ]
  
subject: change migration to split Source column into booleans