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

@@ -443,11 +443,13 @@ class MTIHandler:
443
443
 
444
444
  # Copy field values from source using centralized field extraction
445
445
  for field in parent_model._meta.local_fields:
446
- # Skip AutoField (primary key) - let Django's bulk_create with update_conflicts
447
- # handle PK assignment based on unique_fields. Setting PKs manually here causes
448
- # conflicts when parent records exist but update_conflicts isn't properly configured
449
- # for this level, leading to IntegrityError on primary key constraint.
446
+ # Handle AutoField (primary key) specially
450
447
  if isinstance(field, AutoField):
448
+ # For existing records, we need to copy the PK so that Django's upsert
449
+ # can properly update the existing parent records instead of creating duplicates.
450
+ # This is safe because we're not setting PKs on instances that will be inserted.
451
+ if hasattr(source_obj, 'pk') and source_obj.pk is not None:
452
+ setattr(parent_obj, field.attname, source_obj.pk)
451
453
  continue
452
454
 
453
455
  if hasattr(source_obj, field.name):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: django-bulk-hooks
3
- Version: 0.2.77
3
+ Version: 0.2.78
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
@@ -16,12 +16,12 @@ django_bulk_hooks/operations/analyzer.py,sha256=Pz8mc-EL8KDOfLQFYiRuN-r0OmINW3nI
16
16
  django_bulk_hooks/operations/bulk_executor.py,sha256=po8V_2H3ULiE0RYJ-wbaRIz52SKhss81UHwuQjlz3H8,26214
17
17
  django_bulk_hooks/operations/coordinator.py,sha256=FVzvAMKanVwwoo0ue9CxFOgzTXRgpcegqdx0NTyVEl4,41688
18
18
  django_bulk_hooks/operations/field_utils.py,sha256=cQ9w4xdk-z3PrMLFvRzVV07Wc0D2qbpSepwoupqwQH8,7888
19
- django_bulk_hooks/operations/mti_handler.py,sha256=x1uNvP8MkidifPp_AMp4nffsdW3dz3izV6SeaLJ0DaA,26247
19
+ django_bulk_hooks/operations/mti_handler.py,sha256=eB5fIY53A-4X_7tj-iTbT_dLXGiIf-WosmDPizuizcc,26368
20
20
  django_bulk_hooks/operations/mti_plans.py,sha256=HIRJgogHPpm6MV7nZZ-sZhMLUnozpZPV2SzwQHLRzYc,3667
21
21
  django_bulk_hooks/operations/record_classifier.py,sha256=It85hJC2K-UsEOLbTR-QBdY5UPV-acQIJ91TSGa7pYo,7053
22
22
  django_bulk_hooks/queryset.py,sha256=tPIkNESb47fTIpTrR6xUtc-k3gCFR15W0Xt2-HmvlJo,6811
23
23
  django_bulk_hooks/registry.py,sha256=4HxP1mVK2z4VzvlohbEw2359wM21UJZJYagJJ1komM0,7947
24
- django_bulk_hooks-0.2.77.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
25
- django_bulk_hooks-0.2.77.dist-info/METADATA,sha256=SmJ7zhAY65j6cTMWqQ48wovPyLgJVrPlC2K-dJfbf18,10555
26
- django_bulk_hooks-0.2.77.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
27
- django_bulk_hooks-0.2.77.dist-info/RECORD,,
24
+ django_bulk_hooks-0.2.78.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
25
+ django_bulk_hooks-0.2.78.dist-info/METADATA,sha256=y7AEYmvSmjKbUHqKVgJtdPtzgCr6Dofvhn-szi7z_1Y,10555
26
+ django_bulk_hooks-0.2.78.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
27
+ django_bulk_hooks-0.2.78.dist-info/RECORD,,