6👍
What is Category#category field? The name of the Category? A string?
try resetting that field to be a primary key of the created Category:
def before_import_row(self, row, **kwargs):
name = row.get('category')
(cat, _created) = Category.objects.get_or_create(name=name)
row['category'] = cat.id
Source:stackexchange.com