Django Import-Export Import Duplicate key value violates Error

Solution 1:

I had this issue, because I'd specified a custom import_id_fields field but hadn't excluded the id field.

I had specified:

    import_id_fields = ('code',)
    skip_unchanged = True
    report_skipped = True

But I needed:

    import_id_fields = ('code',)
    skip_unchanged = True
    report_skipped = True
    exclude = ('id',)

Bit of a noob error but this might save someone a google.

Ref: https://github.com/django-import-export/django-import-export/issues/273