django-bulk-hooks 0.1.83__tar.gz → 0.1.84__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.83 → django_bulk_hooks-0.1.84}/PKG-INFO +1 -1
- {django_bulk_hooks-0.1.83 → django_bulk_hooks-0.1.84}/django_bulk_hooks/models.py +12 -7
- {django_bulk_hooks-0.1.83 → django_bulk_hooks-0.1.84}/pyproject.toml +1 -1
- {django_bulk_hooks-0.1.83 → django_bulk_hooks-0.1.84}/LICENSE +0 -0
- {django_bulk_hooks-0.1.83 → django_bulk_hooks-0.1.84}/README.md +0 -0
- {django_bulk_hooks-0.1.83 → django_bulk_hooks-0.1.84}/django_bulk_hooks/__init__.py +0 -0
- {django_bulk_hooks-0.1.83 → django_bulk_hooks-0.1.84}/django_bulk_hooks/conditions.py +0 -0
- {django_bulk_hooks-0.1.83 → django_bulk_hooks-0.1.84}/django_bulk_hooks/constants.py +0 -0
- {django_bulk_hooks-0.1.83 → django_bulk_hooks-0.1.84}/django_bulk_hooks/context.py +0 -0
- {django_bulk_hooks-0.1.83 → django_bulk_hooks-0.1.84}/django_bulk_hooks/decorators.py +0 -0
- {django_bulk_hooks-0.1.83 → django_bulk_hooks-0.1.84}/django_bulk_hooks/engine.py +0 -0
- {django_bulk_hooks-0.1.83 → django_bulk_hooks-0.1.84}/django_bulk_hooks/enums.py +0 -0
- {django_bulk_hooks-0.1.83 → django_bulk_hooks-0.1.84}/django_bulk_hooks/handler.py +0 -0
- {django_bulk_hooks-0.1.83 → django_bulk_hooks-0.1.84}/django_bulk_hooks/manager.py +0 -0
- {django_bulk_hooks-0.1.83 → django_bulk_hooks-0.1.84}/django_bulk_hooks/queryset.py +0 -0
- {django_bulk_hooks-0.1.83 → django_bulk_hooks-0.1.84}/django_bulk_hooks/registry.py +0 -0
|
@@ -60,28 +60,33 @@ class HookModelMixin(models.Model):
|
|
|
60
60
|
ctx = HookContext(self.__class__)
|
|
61
61
|
|
|
62
62
|
if is_create:
|
|
63
|
-
# For create operations,
|
|
63
|
+
# For create operations, run BEFORE hooks first
|
|
64
|
+
run(self.__class__, BEFORE_CREATE, [self], ctx=ctx)
|
|
65
|
+
|
|
66
|
+
# Then let Django save
|
|
64
67
|
super().save(*args, **kwargs)
|
|
65
68
|
|
|
66
|
-
#
|
|
67
|
-
run(self.__class__, BEFORE_CREATE, [self], ctx=ctx)
|
|
69
|
+
# Then run AFTER hooks
|
|
68
70
|
run(self.__class__, AFTER_CREATE, [self], ctx=ctx)
|
|
69
71
|
else:
|
|
70
72
|
# For update operations, we need to get the old record
|
|
71
73
|
try:
|
|
72
74
|
old_instance = self.__class__.objects.get(pk=self.pk)
|
|
73
75
|
|
|
74
|
-
#
|
|
76
|
+
# Run BEFORE hooks first
|
|
77
|
+
run(self.__class__, BEFORE_UPDATE, [self], [old_instance], ctx=ctx)
|
|
78
|
+
|
|
79
|
+
# Then let Django save
|
|
75
80
|
super().save(*args, **kwargs)
|
|
76
81
|
|
|
77
|
-
#
|
|
78
|
-
run(self.__class__, BEFORE_UPDATE, [self], [old_instance], ctx=ctx)
|
|
82
|
+
# Then run AFTER hooks
|
|
79
83
|
run(self.__class__, AFTER_UPDATE, [self], [old_instance], ctx=ctx)
|
|
80
84
|
except self.__class__.DoesNotExist:
|
|
81
85
|
# If the old instance doesn't exist, treat as create
|
|
86
|
+
run(self.__class__, BEFORE_CREATE, [self], ctx=ctx)
|
|
87
|
+
|
|
82
88
|
super().save(*args, **kwargs)
|
|
83
89
|
|
|
84
|
-
run(self.__class__, BEFORE_CREATE, [self], ctx=ctx)
|
|
85
90
|
run(self.__class__, AFTER_CREATE, [self], ctx=ctx)
|
|
86
91
|
|
|
87
92
|
return self
|
|
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
|