django-bulk-hooks 0.1.60__tar.gz → 0.1.61__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.60 → django_bulk_hooks-0.1.61}/PKG-INFO +1 -1
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/django_bulk_hooks/decorators.py +18 -3
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/pyproject.toml +1 -1
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/LICENSE +0 -0
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/README.md +0 -0
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/django_bulk_hooks/__init__.py +0 -0
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/django_bulk_hooks/conditions.py +0 -0
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/django_bulk_hooks/constants.py +0 -0
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/django_bulk_hooks/context.py +0 -0
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/django_bulk_hooks/engine.py +0 -0
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/django_bulk_hooks/enums.py +0 -0
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/django_bulk_hooks/handler.py +0 -0
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/django_bulk_hooks/manager.py +0 -0
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/django_bulk_hooks/models.py +0 -0
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/django_bulk_hooks/priority.py +0 -0
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/django_bulk_hooks/queryset.py +0 -0
- {django_bulk_hooks-0.1.60 → django_bulk_hooks-0.1.61}/django_bulk_hooks/registry.py +0 -0
|
@@ -4,7 +4,7 @@ from functools import wraps
|
|
|
4
4
|
from django.core.exceptions import FieldDoesNotExist
|
|
5
5
|
from django_bulk_hooks.enums import DEFAULT_PRIORITY
|
|
6
6
|
from django_bulk_hooks.constants import BEFORE_UPDATE
|
|
7
|
-
from django_bulk_hooks.
|
|
7
|
+
from django_bulk_hooks.registry import register_hook
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def hook(event, *, model, condition=None, priority=DEFAULT_PRIORITY):
|
|
@@ -116,7 +116,22 @@ def bulk_hook(model_cls, event, when=None, priority=None):
|
|
|
116
116
|
priority: Optional priority for hook execution order
|
|
117
117
|
"""
|
|
118
118
|
def decorator(func):
|
|
119
|
-
#
|
|
120
|
-
|
|
119
|
+
# Create a simple handler class for the function
|
|
120
|
+
class FunctionHandler:
|
|
121
|
+
def __init__(self):
|
|
122
|
+
self.func = func
|
|
123
|
+
|
|
124
|
+
def handle(self, new_instances, original_instances):
|
|
125
|
+
return self.func(new_instances, original_instances)
|
|
126
|
+
|
|
127
|
+
# Register the hook using the registry
|
|
128
|
+
register_hook(
|
|
129
|
+
model=model_cls,
|
|
130
|
+
event=event,
|
|
131
|
+
handler_cls=FunctionHandler,
|
|
132
|
+
method_name='handle',
|
|
133
|
+
condition=when,
|
|
134
|
+
priority=priority or DEFAULT_PRIORITY,
|
|
135
|
+
)
|
|
121
136
|
return func
|
|
122
137
|
return decorator
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "django-bulk-hooks"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.61"
|
|
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"
|
|
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
|