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

@@ -48,7 +48,7 @@ class HookQuerySet(models.QuerySet):
48
48
  for obj in instances:
49
49
  for field, value in kwargs.items():
50
50
  setattr(obj, field, value)
51
-
51
+
52
52
  # Run BEFORE_UPDATE hooks
53
53
  ctx = HookContext(model_cls)
54
54
  engine.run(model_cls, BEFORE_UPDATE, instances, originals, ctx=ctx)
@@ -120,6 +120,7 @@ class HookQuerySet(models.QuerySet):
120
120
  else:
121
121
  # For single-table models, use Django's built-in bulk_create
122
122
  # but we need to call it on the base manager to avoid recursion
123
+
123
124
  result = model_cls._base_manager.bulk_create(
124
125
  objs,
125
126
  batch_size=batch_size,
@@ -175,6 +176,7 @@ class HookQuerySet(models.QuerySet):
175
176
 
176
177
  for i in range(0, len(objs), self.CHUNK_SIZE):
177
178
  chunk = objs[i : i + self.CHUNK_SIZE]
179
+
178
180
  # Call the base implementation to avoid re-triggering this method
179
181
  super().bulk_update(chunk, fields, **kwargs)
180
182
 
@@ -336,6 +338,7 @@ class HookQuerySet(models.QuerySet):
336
338
  created = self._mti_bulk_create(child_objects, inheritance_chain, **kwargs)
337
339
  else:
338
340
  # Single-table, safe to use bulk_create
341
+
339
342
  child_manager = child_model._base_manager
340
343
  child_manager._for_write = True
341
344
  created = child_manager.bulk_create(child_objects, **kwargs)
@@ -364,6 +367,14 @@ class HookQuerySet(models.QuerySet):
364
367
  ):
365
368
  setattr(parent_obj, field.name, current_parent)
366
369
  break
370
+
371
+ # Handle auto_now_add and auto_now fields like Django does
372
+ for field in parent_model._meta.local_fields:
373
+ if hasattr(field, 'auto_now_add') and field.auto_now_add:
374
+ field.pre_save(parent_obj, add=True)
375
+ elif hasattr(field, 'auto_now') and field.auto_now:
376
+ field.pre_save(parent_obj, add=True)
377
+
367
378
  return parent_obj
368
379
 
369
380
  def _create_child_instance(self, source_obj, child_model, parent_instances):
@@ -379,4 +390,12 @@ class HookQuerySet(models.QuerySet):
379
390
  parent_link = child_model._meta.get_ancestor_link(parent_model)
380
391
  if parent_link:
381
392
  setattr(child_obj, parent_link.name, parent_instance)
393
+
394
+ # Handle auto_now_add and auto_now fields like Django does
395
+ for field in child_model._meta.local_fields:
396
+ if hasattr(field, 'auto_now_add') and field.auto_now_add:
397
+ field.pre_save(child_obj, add=True)
398
+ elif hasattr(field, 'auto_now') and field.auto_now:
399
+ field.pre_save(child_obj, add=True)
400
+
382
401
  return child_obj
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: django-bulk-hooks
3
- Version: 0.1.119
3
+ Version: 0.1.121
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=DjEW-nZjhlBW6cp8GRPl6xOSsAmmquP0Y-QyCZMoSHo,6946
10
10
  django_bulk_hooks/models.py,sha256=7RG7GrOdHXFjGVPV4FPRZVNMIHHW-hMCi6hn9LH_hVI,3331
11
11
  django_bulk_hooks/priority.py,sha256=HG_2D35nga68lBCZmSXTcplXrjFoRgZFRDOy4ROKonY,376
12
- django_bulk_hooks/queryset.py,sha256=8hNS49L049_h3GsNZ30UOdrCyW30I_T9ulq8e0UOFps,15089
12
+ django_bulk_hooks/queryset.py,sha256=GPjyhzko8CsZoqj85oqzXjbRMSUaIn7xi6_OdJfyjm4,15914
13
13
  django_bulk_hooks/registry.py,sha256=-mQBizJ06nz_tajZBinViKx_uP2Tbc1tIpTEMv7lwKA,705
14
- django_bulk_hooks-0.1.119.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
15
- django_bulk_hooks-0.1.119.dist-info/METADATA,sha256=CAGAieM9Jj9ap5NxEVpjXmUbXfYxX2JMe_A-Iy9Fqm4,6951
16
- django_bulk_hooks-0.1.119.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
- django_bulk_hooks-0.1.119.dist-info/RECORD,,
14
+ django_bulk_hooks-0.1.121.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
15
+ django_bulk_hooks-0.1.121.dist-info/METADATA,sha256=4_kx2vZEonPYANDAA0PDupUr4r9-QHz63224XPu6t0o,6951
16
+ django_bulk_hooks-0.1.121.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
+ django_bulk_hooks-0.1.121.dist-info/RECORD,,