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

@@ -82,23 +82,24 @@ class HookQuerySetMixin:
82
82
 
83
83
  # If we used Subquery objects, refresh the instances to get computed values
84
84
  if has_subquery and instances:
85
- # Single bulk query to get all updated values
86
- # Use values() to get only the fields we need for maximum performance
87
- field_names = [f.name for f in model_cls._meta.fields if f.name != "id"]
88
- refreshed_data = {
89
- obj["pk"]: obj
90
- for obj in model_cls._base_manager.filter(pk__in=pks).values(
91
- "pk", *field_names
92
- )
85
+ # Simple refresh of model fields without fetching related objects
86
+ # Subquery updates only affect the model's own fields, not relationships
87
+ refreshed_instances = {
88
+ obj.pk: obj for obj in model_cls._base_manager.filter(pk__in=pks)
93
89
  }
94
90
 
95
91
  # Bulk update all instances in memory
96
92
  for instance in instances:
97
- if instance.pk in refreshed_data:
98
- data = refreshed_data[instance.pk]
99
- # Bulk copy all field values except primary key
100
- for field_name in field_names:
101
- setattr(instance, field_name, data[field_name])
93
+ if instance.pk in refreshed_instances:
94
+ refreshed_instance = refreshed_instances[instance.pk]
95
+ # Update all fields except primary key
96
+ for field in model_cls._meta.fields:
97
+ if field.name != "id":
98
+ setattr(
99
+ instance,
100
+ field.name,
101
+ getattr(refreshed_instance, field.name),
102
+ )
102
103
 
103
104
  # Run AFTER_UPDATE hooks
104
105
  engine.run(model_cls, AFTER_UPDATE, instances, originals, ctx=ctx)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-bulk-hooks
3
- Version: 0.1.207
3
+ Version: 0.1.208
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
@@ -9,9 +9,9 @@ django_bulk_hooks/handler.py,sha256=xZt8iNdYF-ACz-MnKMY0co6scWINU5V5wC1lyDn844k,
9
9
  django_bulk_hooks/manager.py,sha256=nfWiwU5-yAoxdnQsUMohxtyCpkV0MBv6X3wmipr9eQY,3697
10
10
  django_bulk_hooks/models.py,sha256=7fnx5xd4HWXfLVlFhhiRzR92JRWFEuxgk6aSWLEsyJg,3996
11
11
  django_bulk_hooks/priority.py,sha256=HG_2D35nga68lBCZmSXTcplXrjFoRgZFRDOy4ROKonY,376
12
- django_bulk_hooks/queryset.py,sha256=YMw8Za_1aqLkCmTqhYKnznq95IVlie3Wx9NBDND7KcM,31387
12
+ django_bulk_hooks/queryset.py,sha256=G55Bd0f4Rb_S1Z06lyXvZ4zEYc18R0uor17kfHjdrog,31469
13
13
  django_bulk_hooks/registry.py,sha256=-mQBizJ06nz_tajZBinViKx_uP2Tbc1tIpTEMv7lwKA,705
14
- django_bulk_hooks-0.1.207.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
15
- django_bulk_hooks-0.1.207.dist-info/METADATA,sha256=6XzEu4cdHtO1kVPzw-vuUmoFjbEUaVrTdEEKAFqEP60,9049
16
- django_bulk_hooks-0.1.207.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
17
- django_bulk_hooks-0.1.207.dist-info/RECORD,,
14
+ django_bulk_hooks-0.1.208.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
15
+ django_bulk_hooks-0.1.208.dist-info/METADATA,sha256=NnIm2Ew0GRwBt3iecx71-RxSZ_x9KJCgFnZklSwPTsU,9049
16
+ django_bulk_hooks-0.1.208.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
17
+ django_bulk_hooks-0.1.208.dist-info/RECORD,,