django-bulk-hooks 0.1.199__tar.gz → 0.1.200__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.199 → django_bulk_hooks-0.1.200}/PKG-INFO +1 -1
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/django_bulk_hooks/queryset.py +0 -24
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/pyproject.toml +1 -1
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/LICENSE +0 -0
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/README.md +0 -0
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/django_bulk_hooks/__init__.py +0 -0
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/django_bulk_hooks/conditions.py +0 -0
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/django_bulk_hooks/constants.py +0 -0
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/django_bulk_hooks/context.py +0 -0
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/django_bulk_hooks/decorators.py +0 -0
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/django_bulk_hooks/engine.py +0 -0
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/django_bulk_hooks/enums.py +0 -0
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/django_bulk_hooks/handler.py +0 -0
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/django_bulk_hooks/manager.py +0 -0
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/django_bulk_hooks/models.py +0 -0
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/django_bulk_hooks/priority.py +0 -0
- {django_bulk_hooks-0.1.199 → django_bulk_hooks-0.1.200}/django_bulk_hooks/registry.py +0 -0
|
@@ -572,25 +572,11 @@ class HookQuerySetMixin:
|
|
|
572
572
|
|
|
573
573
|
# Handle auto_now fields by calling pre_save on objects
|
|
574
574
|
# Check all models in the inheritance chain for auto_now fields
|
|
575
|
-
print(f"DEBUG: Processing {len(objs)} objects for auto_now fields")
|
|
576
|
-
print(f"DEBUG: Inheritance chain: {[m.__name__ for m in inheritance_chain]}")
|
|
577
|
-
|
|
578
575
|
for obj in objs:
|
|
579
|
-
print(f"DEBUG: Processing object {obj.pk if hasattr(obj, 'pk') else 'No PK'}")
|
|
580
576
|
for model in inheritance_chain:
|
|
581
|
-
print(f"DEBUG: Checking model {model.__name__} for auto_now fields")
|
|
582
|
-
auto_now_fields = []
|
|
583
577
|
for field in model._meta.local_fields:
|
|
584
578
|
if hasattr(field, "auto_now") and field.auto_now:
|
|
585
|
-
auto_now_fields.append(field.name)
|
|
586
|
-
print(f"DEBUG: Found auto_now field '{field.name}' on model {model.__name__}")
|
|
587
|
-
old_value = getattr(obj, field.name, None)
|
|
588
579
|
field.pre_save(obj, add=False)
|
|
589
|
-
new_value = getattr(obj, field.name, None)
|
|
590
|
-
print(f"DEBUG: {field.name} value changed from {old_value} to {new_value}")
|
|
591
|
-
|
|
592
|
-
if not auto_now_fields:
|
|
593
|
-
print(f"DEBUG: No auto_now fields found on model {model.__name__}")
|
|
594
580
|
|
|
595
581
|
# Add auto_now fields to the fields list so they get updated in the database
|
|
596
582
|
auto_now_fields = set()
|
|
@@ -601,9 +587,6 @@ class HookQuerySetMixin:
|
|
|
601
587
|
|
|
602
588
|
# Combine original fields with auto_now fields
|
|
603
589
|
all_fields = list(fields) + list(auto_now_fields)
|
|
604
|
-
print(f"DEBUG: Original fields: {fields}")
|
|
605
|
-
print(f"DEBUG: Auto_now fields found: {auto_now_fields}")
|
|
606
|
-
print(f"DEBUG: All fields to update: {all_fields}")
|
|
607
590
|
|
|
608
591
|
# Group fields by model in the inheritance chain
|
|
609
592
|
field_groups = {}
|
|
@@ -665,8 +648,6 @@ class HookQuerySetMixin:
|
|
|
665
648
|
if not model_fields:
|
|
666
649
|
continue
|
|
667
650
|
|
|
668
|
-
print(f"DEBUG: Updating model {model.__name__} with fields: {model_fields}")
|
|
669
|
-
|
|
670
651
|
if model == inheritance_chain[0]:
|
|
671
652
|
# Root model - use primary keys directly
|
|
672
653
|
pks = root_pks
|
|
@@ -692,8 +673,6 @@ class HookQuerySetMixin:
|
|
|
692
673
|
# Check if records exist
|
|
693
674
|
existing_count = base_qs.filter(**{f"{filter_field}__in": pks}).count()
|
|
694
675
|
|
|
695
|
-
print(f"DEBUG: Found {existing_count} existing records for model {model.__name__}")
|
|
696
|
-
|
|
697
676
|
if existing_count == 0:
|
|
698
677
|
continue
|
|
699
678
|
|
|
@@ -703,8 +682,6 @@ class HookQuerySetMixin:
|
|
|
703
682
|
field = model._meta.get_field(field_name)
|
|
704
683
|
when_statements = []
|
|
705
684
|
|
|
706
|
-
print(f"DEBUG: Processing field '{field_name}' for model {model.__name__}")
|
|
707
|
-
|
|
708
685
|
for pk, obj in zip(pks, batch):
|
|
709
686
|
# Check both pk and id attributes for the object
|
|
710
687
|
obj_pk = getattr(obj, 'pk', None)
|
|
@@ -714,7 +691,6 @@ class HookQuerySetMixin:
|
|
|
714
691
|
if obj_pk is None:
|
|
715
692
|
continue
|
|
716
693
|
value = getattr(obj, field_name)
|
|
717
|
-
print(f"DEBUG: Setting {field_name} = {value} for object {obj_pk}")
|
|
718
694
|
when_statements.append(When(**{filter_field: pk}, then=Value(value, output_field=field)))
|
|
719
695
|
|
|
720
696
|
case_statements[field_name] = Case(*when_statements, output_field=field)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "django-bulk-hooks"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.200"
|
|
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
|