django-bulk-hooks 0.1.265__tar.gz → 0.1.266__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.265 → django_bulk_hooks-0.1.266}/PKG-INFO +1 -1
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/django_bulk_hooks/queryset.py +27 -0
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/pyproject.toml +1 -1
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/LICENSE +0 -0
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/README.md +0 -0
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/django_bulk_hooks/__init__.py +0 -0
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/django_bulk_hooks/conditions.py +0 -0
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/django_bulk_hooks/constants.py +0 -0
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/django_bulk_hooks/context.py +0 -0
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/django_bulk_hooks/decorators.py +0 -0
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/django_bulk_hooks/engine.py +0 -0
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/django_bulk_hooks/enums.py +0 -0
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/django_bulk_hooks/handler.py +0 -0
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/django_bulk_hooks/manager.py +0 -0
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/django_bulk_hooks/models.py +0 -0
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/django_bulk_hooks/priority.py +0 -0
- {django_bulk_hooks-0.1.265 → django_bulk_hooks-0.1.266}/django_bulk_hooks/registry.py +0 -0
|
@@ -1122,6 +1122,20 @@ class HookQuerySetMixin:
|
|
|
1122
1122
|
# Filter out parameters that are not supported by Django's bulk_update
|
|
1123
1123
|
unsupported_params = ["unique_fields", "update_conflicts", "update_fields", "ignore_conflicts"]
|
|
1124
1124
|
django_kwargs = {}
|
|
1125
|
+
|
|
1126
|
+
# Check if all objects have primary keys set before proceeding
|
|
1127
|
+
if not all(obj._is_pk_set() for obj in objs):
|
|
1128
|
+
missing_pk_count = sum(1 for obj in objs if not obj._is_pk_set())
|
|
1129
|
+
logger.error(
|
|
1130
|
+
f"bulk_update failed: {missing_pk_count} out of {len(objs)} objects don't have primary keys set. "
|
|
1131
|
+
"All objects must be saved to the database before bulk_update can be used."
|
|
1132
|
+
)
|
|
1133
|
+
print(f"ERROR: {missing_pk_count} objects don't have primary keys set")
|
|
1134
|
+
raise ValueError(
|
|
1135
|
+
f"All bulk_update() objects must have a primary key set. "
|
|
1136
|
+
f"{missing_pk_count} out of {len(objs)} objects are missing primary keys."
|
|
1137
|
+
)
|
|
1138
|
+
|
|
1125
1139
|
for k, v in kwargs.items():
|
|
1126
1140
|
if k in unsupported_params:
|
|
1127
1141
|
logger.warning(
|
|
@@ -1490,6 +1504,19 @@ class HookQuerySetMixin:
|
|
|
1490
1504
|
if inheritance_chain is None:
|
|
1491
1505
|
inheritance_chain = self._get_inheritance_chain()
|
|
1492
1506
|
|
|
1507
|
+
# Check if all objects have primary keys set before proceeding
|
|
1508
|
+
if not all(obj._is_pk_set() for obj in objs):
|
|
1509
|
+
missing_pk_count = sum(1 for obj in objs if not obj._is_pk_set())
|
|
1510
|
+
logger.error(
|
|
1511
|
+
f"MTI bulk_update failed: {missing_pk_count} out of {len(objs)} objects don't have primary keys set. "
|
|
1512
|
+
"All objects must be saved to the database before bulk_update can be used."
|
|
1513
|
+
)
|
|
1514
|
+
print(f"ERROR: {missing_pk_count} objects don't have primary keys set")
|
|
1515
|
+
raise ValueError(
|
|
1516
|
+
f"All bulk_update() objects must have a primary key set. "
|
|
1517
|
+
f"{missing_pk_count} out of {len(objs)} objects are missing primary keys."
|
|
1518
|
+
)
|
|
1519
|
+
|
|
1493
1520
|
# Remove custom hook kwargs and unsupported parameters before passing to Django internals
|
|
1494
1521
|
unsupported_params = ["unique_fields", "update_conflicts", "update_fields", "ignore_conflicts"]
|
|
1495
1522
|
django_kwargs = {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "django-bulk-hooks"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.266"
|
|
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
|