django-bulk-hooks 0.1.50__tar.gz → 0.1.51__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.

Files changed (17) hide show
  1. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/PKG-INFO +3 -3
  2. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/django_bulk_hooks/manager.py +5 -2
  3. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/django_bulk_hooks/queryset.py +3 -5
  4. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/pyproject.toml +1 -1
  5. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/LICENSE +0 -0
  6. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/README.md +0 -0
  7. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/django_bulk_hooks/__init__.py +0 -0
  8. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/django_bulk_hooks/conditions.py +0 -0
  9. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/django_bulk_hooks/constants.py +0 -0
  10. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/django_bulk_hooks/context.py +0 -0
  11. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/django_bulk_hooks/decorators.py +0 -0
  12. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/django_bulk_hooks/engine.py +0 -0
  13. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/django_bulk_hooks/enums.py +0 -0
  14. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/django_bulk_hooks/handler.py +0 -0
  15. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/django_bulk_hooks/models.py +0 -0
  16. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/django_bulk_hooks/priority.py +0 -0
  17. {django_bulk_hooks-0.1.50 → django_bulk_hooks-0.1.51}/django_bulk_hooks/registry.py +0 -0
@@ -1,8 +1,7 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: django-bulk-hooks
3
- Version: 0.1.50
3
+ Version: 0.1.51
4
4
  Summary: Lifecycle-style hooks for Django bulk operations like bulk_create and bulk_update.
5
- Home-page: https://github.com/AugendLimited/django-bulk-hooks
6
5
  License: MIT
7
6
  Keywords: django,bulk,hooks
8
7
  Author: Konrad Beck
@@ -14,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.11
14
13
  Classifier: Programming Language :: Python :: 3.12
15
14
  Classifier: Programming Language :: Python :: 3.13
16
15
  Requires-Dist: Django (>=4.0)
16
+ Project-URL: Homepage, https://github.com/AugendLimited/django-bulk-hooks
17
17
  Project-URL: Repository, https://github.com/AugendLimited/django-bulk-hooks
18
18
  Description-Content-Type: text/markdown
19
19
 
@@ -37,7 +37,10 @@ class BulkLifecycleManager(models.Manager):
37
37
 
38
38
  for i in range(0, len(objs), self.CHUNK_SIZE):
39
39
  chunk = objs[i : i + self.CHUNK_SIZE]
40
- super().bulk_update(chunk, fields, batch_size=batch_size)
40
+ # Call the base implementation to avoid re-triggering this method
41
+ super(models.Manager, self).bulk_update(
42
+ chunk, fields, batch_size=batch_size
43
+ )
41
44
 
42
45
  if not bypass_hooks:
43
46
  engine.run(model_cls, AFTER_UPDATE, objs, originals, ctx=ctx)
@@ -64,7 +67,7 @@ class BulkLifecycleManager(models.Manager):
64
67
  for i in range(0, len(objs), self.CHUNK_SIZE):
65
68
  chunk = objs[i : i + self.CHUNK_SIZE]
66
69
  result.extend(
67
- super().bulk_create(
70
+ super(models.Manager, self).bulk_create(
68
71
  chunk, batch_size=batch_size, ignore_conflicts=ignore_conflicts
69
72
  )
70
73
  )
@@ -19,9 +19,7 @@ class LifecycleQuerySet(models.QuerySet):
19
19
  for field, value in kwargs.items():
20
20
  setattr(obj, field, value)
21
21
 
22
- self.model.objects.bulk_update(
23
- instances,
24
- fields=list(kwargs.keys()),
25
- )
26
-
22
+ # Bypass manager to avoid recursive call to hooks
23
+ from django.db.models import Model
24
+ Model.objects.bulk_update(instances, fields=list(kwargs.keys()))
27
25
  return len(instances)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "django-bulk-hooks"
3
- version = "0.1.50"
3
+ version = "0.1.51"
4
4
  description = "Lifecycle-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"