Errors
Line number: 1 - "Column 'id' not found in dataset. Available columns are: ['name', 'model','content']
class PageResource(resources.ModelResource):
class Meta:
model = Page
import_id_fields = ('name',)
system: python 3.4.3, django 1.9
I think you have to exclude 'id'. I had a similar a problem.
class PageResource(resources.ModelResource):
class Meta:
model = Page
exclude = ('id',)
import_id_fields = ('name',)
I have the same problem, too. I tried using "exclude" sentence, but it still not works. I have to change column name to "id" in my database. Then it read id column, while other columns' content doesn't appear. I am still looking for a solution.
I think @haidaraM explanation solves this issue, the exclude = ('id',) must be used and a new field which you know would be required should be replaced as the new "id". so if the fields where name, firstname, lastname, email, since say email is unique it could be what would be used in the import_id_fields
hi @gbozee @haidaraM ,thanks to comments but it doesn't solve the problem. it seems like the meta class option import_id_fields doesn't work when you give it a new value. it still using the default one 'id'.
import_id_fields does NOT work for me either
And adding exclude = ('id',) did NOT work either.
Python Python 2.7.10
Django 1.11.20
django-import-export 1.2.0
Hello,
import_id_fields does NOT work for me either
And adding exclude = ('id',) did not work either.
Im using Python 3 and Django 2
Most helpful comment
hi @gbozee @haidaraM ,thanks to comments but it doesn't solve the problem. it seems like the meta class option
import_id_fieldsdoesn't work when you give it a new value. it still using the default one 'id'.