django-bulk-hooks 0.1.166__tar.gz → 0.1.168__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.166 → django_bulk_hooks-0.1.168}/PKG-INFO +1 -1
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/django_bulk_hooks/decorators.py +2 -1
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/django_bulk_hooks/queryset.py +10 -7
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/pyproject.toml +1 -1
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/LICENSE +0 -0
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/README.md +0 -0
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/django_bulk_hooks/__init__.py +0 -0
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/django_bulk_hooks/conditions.py +0 -0
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/django_bulk_hooks/constants.py +0 -0
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/django_bulk_hooks/context.py +0 -0
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/django_bulk_hooks/engine.py +0 -0
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/django_bulk_hooks/enums.py +0 -0
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/django_bulk_hooks/handler.py +0 -0
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/django_bulk_hooks/manager.py +0 -0
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/django_bulk_hooks/models.py +0 -0
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/django_bulk_hooks/priority.py +0 -0
- {django_bulk_hooks-0.1.166 → django_bulk_hooks-0.1.168}/django_bulk_hooks/registry.py +0 -0
|
@@ -66,7 +66,8 @@ def select_related(*related_fields):
|
|
|
66
66
|
|
|
67
67
|
fetched = {}
|
|
68
68
|
if ids_to_fetch:
|
|
69
|
-
|
|
69
|
+
# Use the base manager to avoid recursion
|
|
70
|
+
fetched = model_cls._base_manager.select_related(*related_fields).in_bulk(ids_to_fetch)
|
|
70
71
|
|
|
71
72
|
for obj in new_records:
|
|
72
73
|
preloaded = fetched.get(obj.pk)
|
|
@@ -24,7 +24,8 @@ class HookQuerySet(models.QuerySet):
|
|
|
24
24
|
objs = list(self)
|
|
25
25
|
if not objs:
|
|
26
26
|
return 0
|
|
27
|
-
|
|
27
|
+
# Call the base QuerySet implementation to avoid recursion
|
|
28
|
+
return super().bulk_delete(objs)
|
|
28
29
|
|
|
29
30
|
@transaction.atomic
|
|
30
31
|
def update(self, **kwargs):
|
|
@@ -36,7 +37,8 @@ class HookQuerySet(models.QuerySet):
|
|
|
36
37
|
pks = [obj.pk for obj in instances]
|
|
37
38
|
|
|
38
39
|
# Load originals for hook comparison and ensure they match the order of instances
|
|
39
|
-
|
|
40
|
+
# Use the base manager to avoid recursion
|
|
41
|
+
original_map = {obj.pk: obj for obj in model_cls._base_manager.filter(pk__in=pks)}
|
|
40
42
|
originals = [original_map.get(obj.pk) for obj in instances]
|
|
41
43
|
|
|
42
44
|
# Apply field updates to instances
|
|
@@ -49,8 +51,8 @@ class HookQuerySet(models.QuerySet):
|
|
|
49
51
|
engine.run(model_cls, BEFORE_UPDATE, instances, originals, ctx=ctx)
|
|
50
52
|
|
|
51
53
|
# Use Django's built-in update logic directly
|
|
52
|
-
|
|
53
|
-
update_count =
|
|
54
|
+
# Call the base QuerySet implementation to avoid recursion
|
|
55
|
+
update_count = super().update(**kwargs)
|
|
54
56
|
|
|
55
57
|
# Run AFTER_UPDATE hooks
|
|
56
58
|
engine.run(model_cls, AFTER_UPDATE, instances, originals, ctx=ctx)
|
|
@@ -202,9 +204,10 @@ class HookQuerySet(models.QuerySet):
|
|
|
202
204
|
|
|
203
205
|
if not bypass_hooks:
|
|
204
206
|
# Load originals for hook comparison and ensure they match the order of new instances
|
|
207
|
+
# Use the base manager to avoid recursion
|
|
205
208
|
original_map = {
|
|
206
209
|
obj.pk: obj
|
|
207
|
-
for obj in model_cls.
|
|
210
|
+
for obj in model_cls._base_manager.filter(pk__in=[obj.pk for obj in objs])
|
|
208
211
|
}
|
|
209
212
|
originals = [original_map.get(obj.pk) for obj in objs]
|
|
210
213
|
|
|
@@ -274,9 +277,9 @@ class HookQuerySet(models.QuerySet):
|
|
|
274
277
|
|
|
275
278
|
pks = [obj.pk for obj in objs if obj.pk is not None]
|
|
276
279
|
|
|
277
|
-
#
|
|
280
|
+
# Call the base QuerySet implementation to avoid recursion
|
|
278
281
|
# The hooks have already been fired above, so we don't need them again
|
|
279
|
-
|
|
282
|
+
super().bulk_delete(objs, batch_size=batch_size)
|
|
280
283
|
|
|
281
284
|
if not bypass_hooks:
|
|
282
285
|
engine.run(model_cls, AFTER_DELETE, objs, ctx=ctx)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "django-bulk-hooks"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.168"
|
|
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
|