Foreign Key in django migration using django-import-export
问题 I'm using django-import-export to load csv files in a migration file which I understand is current best practise for Django 1.7 to load initial data. This worked fine for the first file: class Country(models.Model): ISO2 = models.CharField(max_length=2, primary_key=True) name = models.CharField(max_length=50, unique=True) and the entire migration file contents. note that ISO2 is the primary key so required the addition line import_id_fields = ['ISO2']. Code adapted from answer to this