django-bulk-hooks 0.1.107__tar.gz → 0.1.108__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of django-bulk-hooks might be problematic. Click here for more details.
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/PKG-INFO +1 -1
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/django_bulk_hooks/manager.py +19 -5
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/pyproject.toml +1 -1
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/LICENSE +0 -0
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/README.md +0 -0
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/django_bulk_hooks/__init__.py +0 -0
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/django_bulk_hooks/conditions.py +0 -0
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/django_bulk_hooks/constants.py +0 -0
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/django_bulk_hooks/context.py +0 -0
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/django_bulk_hooks/decorators.py +0 -0
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/django_bulk_hooks/engine.py +0 -0
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/django_bulk_hooks/enums.py +0 -0
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/django_bulk_hooks/handler.py +0 -0
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/django_bulk_hooks/models.py +0 -0
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/django_bulk_hooks/priority.py +0 -0
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/django_bulk_hooks/queryset.py +0 -0
- {django_bulk_hooks-0.1.107 → django_bulk_hooks-0.1.108}/django_bulk_hooks/registry.py +0 -0
|
@@ -140,20 +140,32 @@ class BulkHookManager(models.Manager):
|
|
|
140
140
|
continue
|
|
141
141
|
|
|
142
142
|
# Handle multi-table inheritance
|
|
143
|
-
# Step 1: Bulk create base objects
|
|
143
|
+
# Step 1: Bulk create base objects with hooks
|
|
144
144
|
base_objects = self._extract_base_objects(class_objects, obj_class)
|
|
145
|
-
|
|
145
|
+
|
|
146
|
+
# Use the model's manager with hooks
|
|
147
|
+
base_model = self._get_base_model(obj_class)
|
|
148
|
+
if hasattr(base_model.objects, 'bulk_create'):
|
|
149
|
+
# Use the base model's manager with hooks
|
|
150
|
+
created_base = base_model.objects.bulk_create(base_objects, **kwargs)
|
|
151
|
+
else:
|
|
152
|
+
# Fallback to _base_manager
|
|
153
|
+
created_base = base_model._base_manager.bulk_create(base_objects, **kwargs)
|
|
146
154
|
|
|
147
155
|
# Step 2: Update original objects with base IDs
|
|
148
156
|
for obj, base_obj in zip(class_objects, created_base):
|
|
149
157
|
obj.pk = base_obj.pk
|
|
150
158
|
obj._state.adding = False
|
|
151
159
|
|
|
152
|
-
# Step 3: Bulk create child objects
|
|
160
|
+
# Step 3: Bulk create child objects with hooks
|
|
153
161
|
child_objects = self._extract_child_objects(class_objects, obj_class)
|
|
154
162
|
if child_objects:
|
|
155
|
-
# Use
|
|
156
|
-
obj_class.
|
|
163
|
+
# Use the model's manager with hooks
|
|
164
|
+
if hasattr(obj_class.objects, 'bulk_create'):
|
|
165
|
+
obj_class.objects.bulk_create(child_objects, **kwargs)
|
|
166
|
+
else:
|
|
167
|
+
# Fallback to _base_manager
|
|
168
|
+
obj_class._base_manager.bulk_create(child_objects, **kwargs)
|
|
157
169
|
|
|
158
170
|
result.extend(class_objects)
|
|
159
171
|
|
|
@@ -163,6 +175,8 @@ class BulkHookManager(models.Manager):
|
|
|
163
175
|
logger = logging.getLogger(__name__)
|
|
164
176
|
logger.error(f"Error in _bulk_create_inherited for {obj_class}: {e}")
|
|
165
177
|
logger.error(f"Model fields: {[f.name for f in obj_class._meta.fields]}")
|
|
178
|
+
logger.error(f"Base model: {self._get_base_model(obj_class)}")
|
|
179
|
+
logger.error(f"Base model manager: {self._get_base_model(obj_class).objects}")
|
|
166
180
|
raise
|
|
167
181
|
|
|
168
182
|
return result
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "django-bulk-hooks"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.108"
|
|
4
4
|
description = "Hook-style hooks for Django bulk operations like bulk_create and bulk_update."
|
|
5
5
|
authors = ["Konrad Beck <konrad.beck@merchantcapital.co.za>"]
|
|
6
6
|
readme = "README.md"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|