From ddde4a2c53e383b55cdf324d0020ac9cbf3a8ee5 Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Mon, 25 May 2020 01:16:08 +0200 Subject: [PATCH] fix inversed logic for detection of multi inherited table --- management/commands/_import_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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):