django-bulk-hooks 0.1.90__tar.gz → 0.1.92__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.92}/PKG-INFO +1 -1
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.92}/django_bulk_hooks/models.py +7 -4
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.92}/pyproject.toml +1 -1
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.92}/LICENSE +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.92}/README.md +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.92}/django_bulk_hooks/__init__.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.92}/django_bulk_hooks/conditions.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.92}/django_bulk_hooks/constants.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.92}/django_bulk_hooks/context.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.92}/django_bulk_hooks/decorators.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.92}/django_bulk_hooks/engine.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.92}/django_bulk_hooks/enums.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.92}/django_bulk_hooks/handler.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.92}/django_bulk_hooks/manager.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.92}/django_bulk_hooks/queryset.py +0 -0
- {django_bulk_hooks-0.1.90 → django_bulk_hooks-0.1.92}/django_bulk_hooks/registry.py +0 -0
|
@@ -91,24 +91,27 @@ class HookModelMixin(models.Model):
|
|
|
91
91
|
is_create = self.pk is None
|
|
92
92
|
ctx = HookContext(self.__class__)
|
|
93
93
|
|
|
94
|
-
#
|
|
94
|
+
# Let Django save first to handle form validation
|
|
95
|
+
super().save(*args, **kwargs)
|
|
96
|
+
|
|
97
|
+
# Then run our hooks with the validated data
|
|
95
98
|
with patch_foreign_key_behavior():
|
|
96
99
|
if is_create:
|
|
97
100
|
# For create operations
|
|
101
|
+
run(self.__class__, VALIDATE_CREATE, [self], ctx=ctx)
|
|
98
102
|
run(self.__class__, BEFORE_CREATE, [self], ctx=ctx)
|
|
99
|
-
super().save(*args, **kwargs)
|
|
100
103
|
run(self.__class__, AFTER_CREATE, [self], ctx=ctx)
|
|
101
104
|
else:
|
|
102
105
|
# For update operations
|
|
103
106
|
try:
|
|
104
107
|
old_instance = self.__class__.objects.get(pk=self.pk)
|
|
108
|
+
run(self.__class__, VALIDATE_UPDATE, [self], [old_instance], ctx=ctx)
|
|
105
109
|
run(self.__class__, BEFORE_UPDATE, [self], [old_instance], ctx=ctx)
|
|
106
|
-
super().save(*args, **kwargs)
|
|
107
110
|
run(self.__class__, AFTER_UPDATE, [self], [old_instance], ctx=ctx)
|
|
108
111
|
except self.__class__.DoesNotExist:
|
|
109
112
|
# If the old instance doesn't exist, treat as create
|
|
113
|
+
run(self.__class__, VALIDATE_CREATE, [self], ctx=ctx)
|
|
110
114
|
run(self.__class__, BEFORE_CREATE, [self], ctx=ctx)
|
|
111
|
-
super().save(*args, **kwargs)
|
|
112
115
|
run(self.__class__, AFTER_CREATE, [self], ctx=ctx)
|
|
113
116
|
|
|
114
117
|
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
|