django-bulk-hooks 0.1.257__py3-none-any.whl → 0.1.258__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 +19 -0
- {django_bulk_hooks-0.1.257.dist-info → django_bulk_hooks-0.1.258.dist-info}/METADATA +1 -1
- {django_bulk_hooks-0.1.257.dist-info → django_bulk_hooks-0.1.258.dist-info}/RECORD +5 -5
- {django_bulk_hooks-0.1.257.dist-info → django_bulk_hooks-0.1.258.dist-info}/LICENSE +0 -0
- {django_bulk_hooks-0.1.257.dist-info → django_bulk_hooks-0.1.258.dist-info}/WHEEL +0 -0
django_bulk_hooks/queryset.py
CHANGED
|
@@ -482,6 +482,11 @@ class HookQuerySetMixin:
|
|
|
482
482
|
passed through to the correct logic. For MTI, only a subset of options may be supported.
|
|
483
483
|
"""
|
|
484
484
|
model_cls = self.model
|
|
485
|
+
|
|
486
|
+
print(f"DEBUG: bulk_create called for {model_cls.__name__} with {len(objs)} objects")
|
|
487
|
+
print(f"DEBUG: update_conflicts={update_conflicts}, unique_fields={unique_fields}, update_fields={update_fields}")
|
|
488
|
+
logger.debug(f"bulk_create called for {model_cls.__name__} with {len(objs)} objects")
|
|
489
|
+
logger.debug(f"update_conflicts={update_conflicts}, unique_fields={unique_fields}, update_fields={update_fields}")
|
|
485
490
|
|
|
486
491
|
# When you bulk insert you don't get the primary keys back (if it's an
|
|
487
492
|
# autoincrement, except if can_return_rows_from_bulk_insert=True), so
|
|
@@ -624,6 +629,20 @@ class HookQuerySetMixin:
|
|
|
624
629
|
# Preserve the original updated_at timestamp
|
|
625
630
|
setattr(obj, field.name, getattr(db_record, field.name))
|
|
626
631
|
|
|
632
|
+
# CRITICAL: For existing records, we need to set updated_at to current time
|
|
633
|
+
# since they are being updated, not just preserved
|
|
634
|
+
if existing_records:
|
|
635
|
+
from django.utils import timezone
|
|
636
|
+
current_time = timezone.now()
|
|
637
|
+
print(f"DEBUG: Setting updated_at to current time for {len(existing_records)} existing records")
|
|
638
|
+
logger.debug(f"Setting updated_at to current time for {len(existing_records)} existing records")
|
|
639
|
+
for obj in existing_records:
|
|
640
|
+
for field in model_cls._meta.local_fields:
|
|
641
|
+
if hasattr(field, "auto_now") and field.auto_now:
|
|
642
|
+
setattr(obj, field.name, current_time)
|
|
643
|
+
print(f"DEBUG: Set {field.name} to {current_time} for existing record {obj.pk}")
|
|
644
|
+
logger.debug(f"Set {field.name} to {current_time} for existing record {obj.pk}")
|
|
645
|
+
|
|
627
646
|
# CRITICAL: Exclude auto_now fields from update_fields for existing records
|
|
628
647
|
# This prevents Django from including them in the ON CONFLICT DO UPDATE clause
|
|
629
648
|
if existing_records and update_fields:
|
|
@@ -9,9 +9,9 @@ django_bulk_hooks/handler.py,sha256=Bx-W6yyiciKMyy-BRxUt3CmRPCrX9_LhQgU-5LaJTjg,
|
|
|
9
9
|
django_bulk_hooks/manager.py,sha256=nfWiwU5-yAoxdnQsUMohxtyCpkV0MBv6X3wmipr9eQY,3697
|
|
10
10
|
django_bulk_hooks/models.py,sha256=WtSfc4GBOG_oOt8n37cVvid0MtFIGze9JYKSixil2y0,4370
|
|
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=BcO9qK2zQUYnMa5c452gYwBrWo6k1PPV4LtVcw8WpUY,71269
|
|
13
13
|
django_bulk_hooks/registry.py,sha256=GRUTGVQEO2sdkC9OaZ9Q3U7mM-3Ix83uTyvrlTtpatw,1317
|
|
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.258.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
|
|
15
|
+
django_bulk_hooks-0.1.258.dist-info/METADATA,sha256=tEc9hgkKa11e6B0qX6c1dAhDpvsUNgoGD5FD6JuEupQ,9061
|
|
16
|
+
django_bulk_hooks-0.1.258.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
17
|
+
django_bulk_hooks-0.1.258.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|