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

@@ -121,20 +121,29 @@ class HookQuerySetMixin:
121
121
  obj_pk = getattr(obj, "pk", None)
122
122
  if obj_pk is None:
123
123
  continue
124
- value = getattr(obj, field_name)
125
- # Normalize relation values to instance or pk consistently
124
+
125
+ # Determine value and output field
126
126
  if getattr(field_obj, "is_relation", False):
127
- # If a model instance is provided, use it; else use as-is
128
- # Value() with output_field handles conversion
129
- pass
127
+ # For FK fields, store the raw id and target field output type
128
+ value = getattr(obj, field_obj.attname, None)
129
+ output_field = field_obj.target_field
130
+ target_name = (
131
+ field_obj.attname
132
+ ) # use column name (e.g., fk_id)
133
+ else:
134
+ value = getattr(obj, field_name)
135
+ output_field = field_obj
136
+ target_name = field_name
130
137
 
131
138
  when_statements.append(
132
- When(pk=obj_pk, then=Value(value, output_field=field_obj))
139
+ When(
140
+ pk=obj_pk, then=Value(value, output_field=output_field)
141
+ )
133
142
  )
134
143
 
135
144
  if when_statements:
136
- case_statements[field_name] = Case(
137
- *when_statements, output_field=field_obj
145
+ case_statements[target_name] = Case(
146
+ *when_statements, output_field=output_field
138
147
  )
139
148
 
140
149
  # Merge extra CASE updates into kwargs for DB update
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-bulk-hooks
3
- Version: 0.1.237
3
+ Version: 0.1.238
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=exnXYVKEVbYAXhChCP8VdWTnKCnm9DiTcokEIBee1I0,4350
11
11
  django_bulk_hooks/priority.py,sha256=HG_2D35nga68lBCZmSXTcplXrjFoRgZFRDOy4ROKonY,376
12
- django_bulk_hooks/queryset.py,sha256=5utEjCnrmJ7tbE2OrDgWf0LU6SCGYoJ1OecmaQW9HVM,35767
12
+ django_bulk_hooks/queryset.py,sha256=OCKx6sXV1LG-aPOJ4gISjnn4zZzWE-R_NMGbzZF91HY,36156
13
13
  django_bulk_hooks/registry.py,sha256=8UuhniiH5ChSeOKV1UUbqTEiIu25bZXvcHmkaRbxmME,1131
14
- django_bulk_hooks-0.1.237.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
15
- django_bulk_hooks-0.1.237.dist-info/METADATA,sha256=_jfrUKLLRuYMbka2ojsBYkINVC4kg8jbb5zVvwOhS8M,9049
16
- django_bulk_hooks-0.1.237.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
17
- django_bulk_hooks-0.1.237.dist-info/RECORD,,
14
+ django_bulk_hooks-0.1.238.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
15
+ django_bulk_hooks-0.1.238.dist-info/METADATA,sha256=DHtPWOMH6HjrqO3jx7Ez1JegBVENAxPJISuexntKE-U,9049
16
+ django_bulk_hooks-0.1.238.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
17
+ django_bulk_hooks-0.1.238.dist-info/RECORD,,