django-bulk-hooks 0.1.90__py3-none-any.whl → 0.1.92__py3-none-any.whl

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.

@@ -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
- # Use a single context manager for all hooks
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: django-bulk-hooks
3
- Version: 0.1.90
3
+ Version: 0.1.92
4
4
  Summary: Hook-style hooks for Django bulk operations like bulk_create and bulk_update.
5
5
  License: MIT
6
6
  Keywords: django,bulk,hooks
@@ -7,10 +7,10 @@ django_bulk_hooks/engine.py,sha256=1hqjmLRmxwI-OSC6GJizD_CFGPw7pndAa0GMIV7P-XQ,3
7
7
  django_bulk_hooks/enums.py,sha256=Zo8_tJzuzZ2IKfVc7gZ-0tWPT8q1QhqZbAyoh9ZVJbs,381
8
8
  django_bulk_hooks/handler.py,sha256=Qpg_zT6SsQiTlhduvzXxPdG6uynjyR2fBjj-R6HZiXI,4861
9
9
  django_bulk_hooks/manager.py,sha256=DcVosEA4RS79KSYgw3Z14_a9Sd8CfxNNc5F3eSb8xc0,11459
10
- django_bulk_hooks/models.py,sha256=9KvWkmrR0wbTHN6r7-FrSSO9ViS83NvG7iXLBw_iDZs,4793
10
+ django_bulk_hooks/models.py,sha256=a9XoGgIG4Sfi_kvGnPBbG2DlvgZDz6Qck4VG-DGqFT0,4981
11
11
  django_bulk_hooks/queryset.py,sha256=7lLqhZ-XOYsZ1I3Loxi4Nhz79M8HlTYE413AW8nyeDI,1330
12
12
  django_bulk_hooks/registry.py,sha256=Vh78exKYcdZhM27120kQm-iXGOjd_kf9ZUYBZ8eQ2V0,683
13
- django_bulk_hooks-0.1.90.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
14
- django_bulk_hooks-0.1.90.dist-info/METADATA,sha256=v4CFYd--pCowFVN0XxbJJ2P3xOQA-n82pDPjgqNGHY4,9051
15
- django_bulk_hooks-0.1.90.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
16
- django_bulk_hooks-0.1.90.dist-info/RECORD,,
13
+ django_bulk_hooks-0.1.92.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
14
+ django_bulk_hooks-0.1.92.dist-info/METADATA,sha256=0ioKPey9yto9oKUf-m97GJxv9Q9Q0d6k7jZiObFH5Gk,9051
15
+ django_bulk_hooks-0.1.92.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
16
+ django_bulk_hooks-0.1.92.dist-info/RECORD,,