django-bulk-hooks 0.1.152__py3-none-any.whl → 0.1.153__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.

@@ -128,9 +128,10 @@ class HookQuerySet(models.QuerySet):
128
128
  'update_fields': update_fields,
129
129
  'unique_fields': unique_fields,
130
130
  }
131
+ # Remove custom hook kwargs if present in self.bulk_create signature
131
132
  result = self._mti_bulk_create(
132
133
  objs,
133
- **mti_kwargs
134
+ **{k: v for k, v in mti_kwargs.items() if k not in ['bypass_hooks', 'bypass_validation']}
134
135
  )
135
136
  else:
136
137
  # For single-table models, use Django's built-in bulk_create
@@ -197,7 +198,9 @@ class HookQuerySet(models.QuerySet):
197
198
  chunk = objs[i : i + self.CHUNK_SIZE]
198
199
 
199
200
  # Call the base implementation to avoid re-triggering this method
200
- super().bulk_update(chunk, fields, **kwargs)
201
+ # Filter out custom parameters that Django's bulk_update doesn't accept
202
+ django_kwargs = {k: v for k, v in kwargs.items() if k not in ['bypass_hooks', 'bypass_validation']}
203
+ super().bulk_update(chunk, fields, **django_kwargs)
201
204
 
202
205
  if not bypass_hooks:
203
206
  engine.run(model_cls, AFTER_UPDATE, objs, originals, ctx=ctx)
@@ -302,6 +305,8 @@ class HookQuerySet(models.QuerySet):
302
305
  then single bulk insert into childmost table.
303
306
  Sets auto_now_add/auto_now fields for each model in the chain.
304
307
  """
308
+ # Remove custom hook kwargs before passing to Django internals
309
+ django_kwargs = {k: v for k, v in kwargs.items() if k not in ['bypass_hooks', 'bypass_validation']}
305
310
  if inheritance_chain is None:
306
311
  inheritance_chain = self._get_inheritance_chain()
307
312
 
@@ -311,13 +316,13 @@ class HookQuerySet(models.QuerySet):
311
316
  "Inheritance chain too deep - possible infinite recursion detected"
312
317
  )
313
318
 
314
- batch_size = kwargs.get("batch_size") or len(objs)
319
+ batch_size = django_kwargs.get("batch_size") or len(objs)
315
320
  created_objects = []
316
321
  with transaction.atomic(using=self.db, savepoint=False):
317
322
  for i in range(0, len(objs), batch_size):
318
323
  batch = objs[i : i + batch_size]
319
324
  batch_result = self._process_mti_batch(
320
- batch, inheritance_chain, **kwargs
325
+ batch, inheritance_chain, **django_kwargs
321
326
  )
322
327
  created_objects.extend(batch_result)
323
328
  return created_objects
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: django-bulk-hooks
3
- Version: 0.1.152
3
+ Version: 0.1.153
4
4
  Summary: Hook-style hooks for Django bulk operations like bulk_create and bulk_update.
5
5
  License: MIT
6
6
  Keywords: django,bulk,hooks
@@ -9,9 +9,9 @@ django_bulk_hooks/handler.py,sha256=xZt8iNdYF-ACz-MnKMY0co6scWINU5V5wC1lyDn844k,
9
9
  django_bulk_hooks/manager.py,sha256=r54ct3S6AcqME2OsX-jPF944CEKcoSIW3qiAx_NwUaw,2801
10
10
  django_bulk_hooks/models.py,sha256=5PBjBoGlHwAE5b4yaZ5kDjt5UtHfQp6pDrwB2XPs2tk,3850
11
11
  django_bulk_hooks/priority.py,sha256=HG_2D35nga68lBCZmSXTcplXrjFoRgZFRDOy4ROKonY,376
12
- django_bulk_hooks/queryset.py,sha256=0lNdjLG1aUVh3CDjRwiYenCgzqqicZdSYwQOE7nP7zQ,22344
12
+ django_bulk_hooks/queryset.py,sha256=gs7Ge5AoyVc6mea-jebedUNfwmM75zIpu1s6bO5qC7U,22903
13
13
  django_bulk_hooks/registry.py,sha256=-mQBizJ06nz_tajZBinViKx_uP2Tbc1tIpTEMv7lwKA,705
14
- django_bulk_hooks-0.1.152.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
15
- django_bulk_hooks-0.1.152.dist-info/METADATA,sha256=KxAFW1u6RpoU-GEZdWR3i3Z9YxcOnyFZMvmiz5KtQ6U,6951
16
- django_bulk_hooks-0.1.152.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
- django_bulk_hooks-0.1.152.dist-info/RECORD,,
14
+ django_bulk_hooks-0.1.153.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
15
+ django_bulk_hooks-0.1.153.dist-info/METADATA,sha256=Up1df98LtKaSSn6LEAzB3S38YFRMGxSXHK-_0c5sfY4,6951
16
+ django_bulk_hooks-0.1.153.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
+ django_bulk_hooks-0.1.153.dist-info/RECORD,,