diff --git a/management/commands/_import_utils.py b/management/commands/_import_utils.py index 9563517..731048c 100644 --- a/management/commands/_import_utils.py +++ b/management/commands/_import_utils.py @@ -7,8 +7,6 @@ from collections import defaultdict from django.apps import apps from django.db import transaction -from django.contrib.auth.models import User -from django.db.models import Model from polymorphic.models import PolymorphicModel @@ -67,7 +65,9 @@ class BulkCreateManager(object): def _commit(self, model_class): model_key = model_class._meta.label - if model_class.__base__ in [Model, PolymorphicModel] or model_class is User: + # check for mutli-table inheritance it happens + # if model_class is a grand-child of PolymorphicModel + if model_class.__base__ is not PolymorphicModel and model_class.__base__.__base__ is PolymorphicModel: model_class.objects.bulk_create(self._create_queues[model_key]) else: # ensure that parents models exists