django-bulk-hooks 0.1.258__tar.gz → 0.1.259__tar.gz
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-0.1.258 → django_bulk_hooks-0.1.259}/PKG-INFO +1 -1
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/django_bulk_hooks/queryset.py +6 -17
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/pyproject.toml +1 -1
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/LICENSE +0 -0
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/README.md +0 -0
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/django_bulk_hooks/__init__.py +0 -0
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/django_bulk_hooks/conditions.py +0 -0
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/django_bulk_hooks/constants.py +0 -0
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/django_bulk_hooks/context.py +0 -0
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/django_bulk_hooks/decorators.py +0 -0
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/django_bulk_hooks/engine.py +0 -0
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/django_bulk_hooks/enums.py +0 -0
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/django_bulk_hooks/handler.py +0 -0
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/django_bulk_hooks/manager.py +0 -0
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/django_bulk_hooks/models.py +0 -0
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/django_bulk_hooks/priority.py +0 -0
- {django_bulk_hooks-0.1.258 → django_bulk_hooks-0.1.259}/django_bulk_hooks/registry.py +0 -0
|
@@ -619,29 +619,18 @@ class HookQuerySetMixin:
|
|
|
619
619
|
key = tuple(getattr(db_record, field) for field in unique_fields)
|
|
620
620
|
existing_db_map[key] = db_record
|
|
621
621
|
|
|
622
|
-
#
|
|
622
|
+
# For existing records, set auto_now fields using Django's pre_save method
|
|
623
623
|
for obj in existing_records:
|
|
624
624
|
key = tuple(getattr(obj, field) for field in unique_fields)
|
|
625
625
|
if key in existing_db_map:
|
|
626
|
-
|
|
626
|
+
# Use Django's pre_save method to set auto_now fields (like updated_at)
|
|
627
627
|
for field in model_cls._meta.local_fields:
|
|
628
628
|
if hasattr(field, "auto_now") and field.auto_now:
|
|
629
|
-
#
|
|
630
|
-
|
|
629
|
+
field.pre_save(obj, add=False) # add=False for updates
|
|
630
|
+
print(f"DEBUG: Set {field.name} using pre_save for existing record {obj.pk}")
|
|
631
|
+
logger.debug(f"Set {field.name} using pre_save for existing record {obj.pk}")
|
|
631
632
|
|
|
632
|
-
#
|
|
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}")
|
|
633
|
+
# Remove duplicate code since we're now handling this above
|
|
645
634
|
|
|
646
635
|
# CRITICAL: Exclude auto_now fields from update_fields for existing records
|
|
647
636
|
# This prevents Django from including them in the ON CONFLICT DO UPDATE clause
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "django-bulk-hooks"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.259"
|
|
4
4
|
description = "Hook-style hooks for Django bulk operations like bulk_create and bulk_update."
|
|
5
5
|
authors = ["Konrad Beck <konrad.beck@merchantcapital.co.za>"]
|
|
6
6
|
readme = "README.md"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|