django-bulk-hooks 0.1.198__tar.gz → 0.1.199__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.198 → django_bulk_hooks-0.1.199}/PKG-INFO +1 -1
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/django_bulk_hooks/queryset.py +21 -1
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/pyproject.toml +1 -1
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/LICENSE +0 -0
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/README.md +0 -0
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/django_bulk_hooks/__init__.py +0 -0
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/django_bulk_hooks/conditions.py +0 -0
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/django_bulk_hooks/constants.py +0 -0
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/django_bulk_hooks/context.py +0 -0
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/django_bulk_hooks/decorators.py +0 -0
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/django_bulk_hooks/engine.py +0 -0
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/django_bulk_hooks/enums.py +0 -0
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/django_bulk_hooks/handler.py +0 -0
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/django_bulk_hooks/manager.py +0 -0
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/django_bulk_hooks/models.py +0 -0
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/django_bulk_hooks/priority.py +0 -0
- {django_bulk_hooks-0.1.198 → django_bulk_hooks-0.1.199}/django_bulk_hooks/registry.py +0 -0
|
@@ -592,9 +592,22 @@ class HookQuerySetMixin:
|
|
|
592
592
|
if not auto_now_fields:
|
|
593
593
|
print(f"DEBUG: No auto_now fields found on model {model.__name__}")
|
|
594
594
|
|
|
595
|
+
# Add auto_now fields to the fields list so they get updated in the database
|
|
596
|
+
auto_now_fields = set()
|
|
597
|
+
for model in inheritance_chain:
|
|
598
|
+
for field in model._meta.local_fields:
|
|
599
|
+
if hasattr(field, "auto_now") and field.auto_now:
|
|
600
|
+
auto_now_fields.add(field.name)
|
|
601
|
+
|
|
602
|
+
# Combine original fields with auto_now fields
|
|
603
|
+
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
|
+
|
|
595
608
|
# Group fields by model in the inheritance chain
|
|
596
609
|
field_groups = {}
|
|
597
|
-
for field_name in
|
|
610
|
+
for field_name in all_fields:
|
|
598
611
|
field = model_cls._meta.get_field(field_name)
|
|
599
612
|
# Find which model in the inheritance chain this field belongs to
|
|
600
613
|
for model in inheritance_chain:
|
|
@@ -652,6 +665,8 @@ class HookQuerySetMixin:
|
|
|
652
665
|
if not model_fields:
|
|
653
666
|
continue
|
|
654
667
|
|
|
668
|
+
print(f"DEBUG: Updating model {model.__name__} with fields: {model_fields}")
|
|
669
|
+
|
|
655
670
|
if model == inheritance_chain[0]:
|
|
656
671
|
# Root model - use primary keys directly
|
|
657
672
|
pks = root_pks
|
|
@@ -677,6 +692,8 @@ class HookQuerySetMixin:
|
|
|
677
692
|
# Check if records exist
|
|
678
693
|
existing_count = base_qs.filter(**{f"{filter_field}__in": pks}).count()
|
|
679
694
|
|
|
695
|
+
print(f"DEBUG: Found {existing_count} existing records for model {model.__name__}")
|
|
696
|
+
|
|
680
697
|
if existing_count == 0:
|
|
681
698
|
continue
|
|
682
699
|
|
|
@@ -686,6 +703,8 @@ class HookQuerySetMixin:
|
|
|
686
703
|
field = model._meta.get_field(field_name)
|
|
687
704
|
when_statements = []
|
|
688
705
|
|
|
706
|
+
print(f"DEBUG: Processing field '{field_name}' for model {model.__name__}")
|
|
707
|
+
|
|
689
708
|
for pk, obj in zip(pks, batch):
|
|
690
709
|
# Check both pk and id attributes for the object
|
|
691
710
|
obj_pk = getattr(obj, 'pk', None)
|
|
@@ -695,6 +714,7 @@ class HookQuerySetMixin:
|
|
|
695
714
|
if obj_pk is None:
|
|
696
715
|
continue
|
|
697
716
|
value = getattr(obj, field_name)
|
|
717
|
+
print(f"DEBUG: Setting {field_name} = {value} for object {obj_pk}")
|
|
698
718
|
when_statements.append(When(**{filter_field: pk}, then=Value(value, output_field=field)))
|
|
699
719
|
|
|
700
720
|
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.199"
|
|
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
|