django-bulk-hooks 0.1.113__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.

@@ -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
- # Use Django's _base_manager for child table to avoid recursion
213
- child_manager = child_model._base_manager
214
- child_manager._for_write = True
215
- created = child_manager.bulk_create(child_objects, **kwargs)
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):
@@ -13,11 +13,11 @@ from django_bulk_hooks.constants import (
13
13
  )
14
14
  from django_bulk_hooks.context import HookContext
15
15
  from django_bulk_hooks.engine import run
16
- from django_bulk_hooks.manager import BulkManager
16
+ from django_bulk_hooks.manager import BulkHookManager
17
17
 
18
18
 
19
19
  class HookModelMixin(models.Model):
20
- objects = BulkManager()
20
+ objects = BulkHookManager()
21
21
 
22
22
  class Meta:
23
23
  abstract = True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-bulk-hooks
3
- Version: 0.1.113
3
+ Version: 0.1.115
4
4
  Summary: Hook-style hooks for Django bulk operations like bulk_create and bulk_update.
5
5
  Home-page: https://github.com/AugendLimited/django-bulk-hooks
6
6
  License: MIT
@@ -48,7 +48,7 @@ from django_bulk_hooks.models import HookModelMixin
48
48
 
49
49
  class Account(HookModelMixin):
50
50
  balance = models.DecimalField(max_digits=10, decimal_places=2)
51
- # The HookModelMixin automatically provides BulkManager
51
+ # The HookModelMixin automatically provides BulkHookManager
52
52
  ```
53
53
 
54
54
  ### Create a Hook Handler
@@ -204,10 +204,10 @@ LoanAccount.objects.bulk_update(reordered, ['balance'])
204
204
 
205
205
  ## 🧩 Integration with Queryable Properties
206
206
 
207
- You can extend from `BulkManager` to support formula fields or property querying.
207
+ You can extend from `BulkHookManager` to support formula fields or property querying.
208
208
 
209
209
  ```python
210
- class MyManager(BulkManager, QueryablePropertiesManager):
210
+ class MyManager(BulkHookManager, QueryablePropertiesManager):
211
211
  pass
212
212
  ```
213
213
 
@@ -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=XJzWQmkJB-gkAn3YGDnOdkNG-cZlsw8FdNljlH4LMYo,12510
10
- django_bulk_hooks/models.py,sha256=zb5DGqVezzQe3wCHdtwmwcqjRE8RBZ9Vy8nU5e6zrTw,3323
9
+ django_bulk_hooks/manager.py,sha256=sQ9xDCo3MRp2CNwsfo_a_43LzlWlSdqqoz04oUp6sx8,13351
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.113.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
15
- django_bulk_hooks-0.1.113.dist-info/METADATA,sha256=_cTiMJbj7lRAS6aZOG_trK8yfYm0l5kF5eScc4_pim8,6927
16
- django_bulk_hooks-0.1.113.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
17
- django_bulk_hooks-0.1.113.dist-info/RECORD,,
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,,