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.
- django_bulk_hooks/queryset.py +14 -13
- {django_bulk_hooks-0.1.207.dist-info → django_bulk_hooks-0.1.208.dist-info}/METADATA +1 -1
- {django_bulk_hooks-0.1.207.dist-info → django_bulk_hooks-0.1.208.dist-info}/RECORD +5 -5
- {django_bulk_hooks-0.1.207.dist-info → django_bulk_hooks-0.1.208.dist-info}/LICENSE +0 -0
- {django_bulk_hooks-0.1.207.dist-info → django_bulk_hooks-0.1.208.dist-info}/WHEEL +0 -0
django_bulk_hooks/queryset.py
CHANGED
|
@@ -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
|
-
#
|
|
86
|
-
#
|
|
87
|
-
|
|
88
|
-
|
|
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
|
|
98
|
-
|
|
99
|
-
#
|
|
100
|
-
for
|
|
101
|
-
|
|
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)
|
|
@@ -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=
|
|
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.
|
|
15
|
-
django_bulk_hooks-0.1.
|
|
16
|
-
django_bulk_hooks-0.1.
|
|
17
|
-
django_bulk_hooks-0.1.
|
|
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,,
|
|
File without changes
|
|
File without changes
|