django-bulk-hooks 0.1.90__tar.gz → 0.1.91__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.90 → django_bulk_hooks-0.1.91}/PKG-INFO +1 -1
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.91}/django_bulk_hooks/models.py +11 -1
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.91}/pyproject.toml +1 -1
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.91}/LICENSE +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.91}/README.md +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.91}/django_bulk_hooks/__init__.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.91}/django_bulk_hooks/conditions.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.91}/django_bulk_hooks/constants.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.91}/django_bulk_hooks/context.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.91}/django_bulk_hooks/decorators.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.91}/django_bulk_hooks/engine.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.91}/django_bulk_hooks/enums.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.91}/django_bulk_hooks/handler.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.91}/django_bulk_hooks/manager.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.91}/django_bulk_hooks/queryset.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.91}/django_bulk_hooks/registry.py +0 -0
|
@@ -94,19 +94,29 @@ class HookModelMixin(models.Model):
|
|
|
94
94
|
# Use a single context manager for all hooks
|
|
95
95
|
with patch_foreign_key_behavior():
|
|
96
96
|
if is_create:
|
|
97
|
-
# For create operations
|
|
97
|
+
# For create operations, run validation hooks first
|
|
98
|
+
run(self.__class__, VALIDATE_CREATE, [self], ctx=ctx)
|
|
99
|
+
# Then run BEFORE hooks
|
|
98
100
|
run(self.__class__, BEFORE_CREATE, [self], ctx=ctx)
|
|
101
|
+
# Now save
|
|
99
102
|
super().save(*args, **kwargs)
|
|
103
|
+
# Finally run AFTER hooks
|
|
100
104
|
run(self.__class__, AFTER_CREATE, [self], ctx=ctx)
|
|
101
105
|
else:
|
|
102
106
|
# For update operations
|
|
103
107
|
try:
|
|
104
108
|
old_instance = self.__class__.objects.get(pk=self.pk)
|
|
109
|
+
# Run validation hooks first
|
|
110
|
+
run(self.__class__, VALIDATE_UPDATE, [self], [old_instance], ctx=ctx)
|
|
111
|
+
# Then run BEFORE hooks
|
|
105
112
|
run(self.__class__, BEFORE_UPDATE, [self], [old_instance], ctx=ctx)
|
|
113
|
+
# Now save
|
|
106
114
|
super().save(*args, **kwargs)
|
|
115
|
+
# Finally run AFTER hooks
|
|
107
116
|
run(self.__class__, AFTER_UPDATE, [self], [old_instance], ctx=ctx)
|
|
108
117
|
except self.__class__.DoesNotExist:
|
|
109
118
|
# If the old instance doesn't exist, treat as create
|
|
119
|
+
run(self.__class__, VALIDATE_CREATE, [self], ctx=ctx)
|
|
110
120
|
run(self.__class__, BEFORE_CREATE, [self], ctx=ctx)
|
|
111
121
|
super().save(*args, **kwargs)
|
|
112
122
|
run(self.__class__, AFTER_CREATE, [self], ctx=ctx)
|
|
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
|