django-bulk-hooks 0.1.114__py3-none-any.whl → 0.1.115__py3-none-any.whl
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/manager.py +21 -4
- {django_bulk_hooks-0.1.114.dist-info → django_bulk_hooks-0.1.115.dist-info}/METADATA +1 -1
- {django_bulk_hooks-0.1.114.dist-info → django_bulk_hooks-0.1.115.dist-info}/RECORD +5 -5
- {django_bulk_hooks-0.1.114.dist-info → django_bulk_hooks-0.1.115.dist-info}/LICENSE +0 -0
- {django_bulk_hooks-0.1.114.dist-info → django_bulk_hooks-0.1.115.dist-info}/WHEEL +0 -0
django_bulk_hooks/manager.py
CHANGED
|
@@ -209,10 +209,27 @@ class BulkHookManager(models.Manager):
|
|
|
209
209
|
obj, child_model, parent_objects_map.get(id(obj), {})
|
|
210
210
|
)
|
|
211
211
|
child_objects.append(child_obj)
|
|
212
|
-
#
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
212
|
+
# If the child model is still MTI, call our own logic recursively
|
|
213
|
+
if len([p for p in child_model._meta.parents.keys() if not p._meta.proxy]) > 0:
|
|
214
|
+
# Build inheritance chain for the child model
|
|
215
|
+
inheritance_chain = []
|
|
216
|
+
current_model = child_model
|
|
217
|
+
while current_model:
|
|
218
|
+
if not current_model._meta.proxy:
|
|
219
|
+
inheritance_chain.append(current_model)
|
|
220
|
+
parents = [
|
|
221
|
+
parent
|
|
222
|
+
for parent in current_model._meta.parents.keys()
|
|
223
|
+
if not parent._meta.proxy
|
|
224
|
+
]
|
|
225
|
+
current_model = parents[0] if parents else None
|
|
226
|
+
inheritance_chain.reverse()
|
|
227
|
+
created = self._mti_bulk_create(child_objects, inheritance_chain, **kwargs)
|
|
228
|
+
else:
|
|
229
|
+
# Single-table, safe to use bulk_create
|
|
230
|
+
child_manager = child_model._base_manager
|
|
231
|
+
child_manager._for_write = True
|
|
232
|
+
created = child_manager.bulk_create(child_objects, **kwargs)
|
|
216
233
|
# Step 3: Update original objects with generated PKs and state
|
|
217
234
|
pk_field_name = child_model._meta.pk.name
|
|
218
235
|
for orig_obj, child_obj in zip(batch, created):
|
|
@@ -6,12 +6,12 @@ django_bulk_hooks/decorators.py,sha256=tckDcxtOzKCbgvS9QydgeIAWTFDEl-ch3_Q--ruEG
|
|
|
6
6
|
django_bulk_hooks/engine.py,sha256=3HbgV12JRYIy9IlygHPxZiHnFXj7EwzLyTuJNQeVIoI,1402
|
|
7
7
|
django_bulk_hooks/enums.py,sha256=Zo8_tJzuzZ2IKfVc7gZ-0tWPT8q1QhqZbAyoh9ZVJbs,381
|
|
8
8
|
django_bulk_hooks/handler.py,sha256=xZt8iNdYF-ACz-MnKMY0co6scWINU5V5wC1lyDn844k,4854
|
|
9
|
-
django_bulk_hooks/manager.py,sha256=
|
|
9
|
+
django_bulk_hooks/manager.py,sha256=sQ9xDCo3MRp2CNwsfo_a_43LzlWlSdqqoz04oUp6sx8,13351
|
|
10
10
|
django_bulk_hooks/models.py,sha256=7RG7GrOdHXFjGVPV4FPRZVNMIHHW-hMCi6hn9LH_hVI,3331
|
|
11
11
|
django_bulk_hooks/priority.py,sha256=HG_2D35nga68lBCZmSXTcplXrjFoRgZFRDOy4ROKonY,376
|
|
12
12
|
django_bulk_hooks/queryset.py,sha256=iet4z-9SKhnresA4FBQbxx9rdYnoaOWbw9LUlGftlP0,1466
|
|
13
13
|
django_bulk_hooks/registry.py,sha256=-mQBizJ06nz_tajZBinViKx_uP2Tbc1tIpTEMv7lwKA,705
|
|
14
|
-
django_bulk_hooks-0.1.
|
|
15
|
-
django_bulk_hooks-0.1.
|
|
16
|
-
django_bulk_hooks-0.1.
|
|
17
|
-
django_bulk_hooks-0.1.
|
|
14
|
+
django_bulk_hooks-0.1.115.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
|
|
15
|
+
django_bulk_hooks-0.1.115.dist-info/METADATA,sha256=uA5Qw2PzVWnyDRiGHqr6pF3AdeoQ4xhMUh_eJSoOSRs,6939
|
|
16
|
+
django_bulk_hooks-0.1.115.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
17
|
+
django_bulk_hooks-0.1.115.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|