diff --git a/management/commands/_import_utils.py b/management/commands/_import_utils.py index 76552a7..aad9b8e 100644 --- a/management/commands/_import_utils.py +++ b/management/commands/_import_utils.py @@ -83,13 +83,13 @@ class BulkCreateManager(object): # 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 self._commit(model_class.__base__) with transaction.atomic(): for obj in self._create_queues[model_key]: obj.save_base(raw=True) + else: + # ensure that parents models exists + model_class.objects.bulk_create(self._create_queues[model_key]) self._create_queues[model_key] = [] def add(self, *args):