django-bulk-hooks 0.1.161__py3-none-any.whl → 0.1.162__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.

@@ -20,7 +20,15 @@ class BulkHookManager(models.Manager):
20
20
  print(f"DEBUG: bulk_update method signature: {inspect.signature(method)}")
21
21
  print(f"DEBUG: Calling with args: objs={type(objs)}, fields={fields}, bypass_hooks={bypass_hooks}, bypass_validation={bypass_validation}, kwargs={kwargs}")
22
22
  print(f"DEBUG: QuerySet class: {type(qs)}")
23
- return qs.bulk_update(objs, fields, bypass_hooks, bypass_validation, **kwargs)
23
+
24
+ # Check if this is our HookQuerySet or a different QuerySet
25
+ if hasattr(qs, 'bulk_update') and 'bypass_hooks' in inspect.signature(qs.bulk_update).parameters:
26
+ # Our HookQuerySet - pass all parameters
27
+ return qs.bulk_update(objs, fields, bypass_hooks=bypass_hooks, bypass_validation=bypass_validation, **kwargs)
28
+ else:
29
+ # Different QuerySet (like queryable_properties) - only pass standard parameters
30
+ django_kwargs = {k: v for k, v in kwargs.items() if k not in ['bypass_hooks', 'bypass_validation']}
31
+ return qs.bulk_update(objs, fields, **django_kwargs)
24
32
 
25
33
  def bulk_create(
26
34
  self,
@@ -37,19 +45,31 @@ class BulkHookManager(models.Manager):
37
45
  Delegate to QuerySet's bulk_create implementation.
38
46
  This follows Django's pattern where Manager methods call QuerySet methods.
39
47
  """
40
- kwargs = {
41
- 'batch_size': batch_size,
42
- 'ignore_conflicts': ignore_conflicts,
43
- 'update_conflicts': update_conflicts,
44
- 'update_fields': update_fields,
45
- 'unique_fields': unique_fields,
46
- }
47
- return self.get_queryset().bulk_create(
48
- objs,
49
- bypass_hooks=bypass_hooks,
50
- bypass_validation=bypass_validation,
51
- **kwargs
52
- )
48
+ import inspect
49
+ qs = self.get_queryset()
50
+ method = qs.bulk_create
51
+
52
+ # Check if this is our HookQuerySet or a different QuerySet
53
+ if hasattr(qs, 'bulk_create') and 'bypass_hooks' in inspect.signature(qs.bulk_create).parameters:
54
+ # Our HookQuerySet - pass all parameters
55
+ kwargs = {
56
+ 'batch_size': batch_size,
57
+ 'ignore_conflicts': ignore_conflicts,
58
+ 'update_conflicts': update_conflicts,
59
+ 'update_fields': update_fields,
60
+ 'unique_fields': unique_fields,
61
+ }
62
+ return qs.bulk_create(objs, bypass_hooks=bypass_hooks, bypass_validation=bypass_validation, **kwargs)
63
+ else:
64
+ # Different QuerySet - only pass standard parameters
65
+ kwargs = {
66
+ 'batch_size': batch_size,
67
+ 'ignore_conflicts': ignore_conflicts,
68
+ 'update_conflicts': update_conflicts,
69
+ 'update_fields': update_fields,
70
+ 'unique_fields': unique_fields,
71
+ }
72
+ return qs.bulk_create(objs, **kwargs)
53
73
 
54
74
  def bulk_delete(
55
75
  self, objs, batch_size=None, bypass_hooks=False, bypass_validation=False
@@ -58,10 +78,23 @@ class BulkHookManager(models.Manager):
58
78
  Delegate to QuerySet's bulk_delete implementation.
59
79
  This follows Django's pattern where Manager methods call QuerySet methods.
60
80
  """
61
- kwargs = {
62
- 'batch_size': batch_size,
63
- }
64
- return self.get_queryset().bulk_delete(objs, bypass_hooks=bypass_hooks, bypass_validation=bypass_validation, **kwargs)
81
+ import inspect
82
+ qs = self.get_queryset()
83
+ method = qs.bulk_delete
84
+
85
+ # Check if this is our HookQuerySet or a different QuerySet
86
+ if hasattr(qs, 'bulk_delete') and 'bypass_hooks' in inspect.signature(qs.bulk_delete).parameters:
87
+ # Our HookQuerySet - pass all parameters
88
+ kwargs = {
89
+ 'batch_size': batch_size,
90
+ }
91
+ return qs.bulk_delete(objs, bypass_hooks=bypass_hooks, bypass_validation=bypass_validation, **kwargs)
92
+ else:
93
+ # Different QuerySet - only pass standard parameters
94
+ kwargs = {
95
+ 'batch_size': batch_size,
96
+ }
97
+ return qs.bulk_delete(objs, **kwargs)
65
98
 
66
99
  def update(self, **kwargs):
67
100
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: django-bulk-hooks
3
- Version: 0.1.161
3
+ Version: 0.1.162
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
@@ -6,12 +6,12 @@ django_bulk_hooks/decorators.py,sha256=tckDcxtOzKCbgvS9QydgeIAWTFDEl-ch3_Q--ruEG
6
6
  django_bulk_hooks/engine.py,sha256=3HbgV12JRYIy9IlygHPxZiHnFXj7EwzLyTuJNQeVIoI,1402
7
7
  django_bulk_hooks/enums.py,sha256=Zo8_tJzuzZ2IKfVc7gZ-0tWPT8q1QhqZbAyoh9ZVJbs,381
8
8
  django_bulk_hooks/handler.py,sha256=xZt8iNdYF-ACz-MnKMY0co6scWINU5V5wC1lyDn844k,4854
9
- django_bulk_hooks/manager.py,sha256=D7wlLgOnoIqXgOKhYhhqhl72SfbW5hJlzM8SRrwxueI,3223
9
+ django_bulk_hooks/manager.py,sha256=7wQv2V1SgfjshFSqwDdIuWU3NrRKQ4y-3mpV47JTZXc,5035
10
10
  django_bulk_hooks/models.py,sha256=5PBjBoGlHwAE5b4yaZ5kDjt5UtHfQp6pDrwB2XPs2tk,3850
11
11
  django_bulk_hooks/priority.py,sha256=HG_2D35nga68lBCZmSXTcplXrjFoRgZFRDOy4ROKonY,376
12
12
  django_bulk_hooks/queryset.py,sha256=PlT0ygU8Hrb6w1XESxEuAnKgmUuq-K_bFgHg3LBSogA,23274
13
13
  django_bulk_hooks/registry.py,sha256=-mQBizJ06nz_tajZBinViKx_uP2Tbc1tIpTEMv7lwKA,705
14
- django_bulk_hooks-0.1.161.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
15
- django_bulk_hooks-0.1.161.dist-info/METADATA,sha256=n2xv1f53t-QtAoPQ9yanpgSEYxxcBfpH6DAJiG0dn9M,6951
16
- django_bulk_hooks-0.1.161.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
- django_bulk_hooks-0.1.161.dist-info/RECORD,,
14
+ django_bulk_hooks-0.1.162.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
15
+ django_bulk_hooks-0.1.162.dist-info/METADATA,sha256=XzFCAvWbGpuNeG5yCe1YSQHqKtY77r_gnE5G8oZPhQY,6951
16
+ django_bulk_hooks-0.1.162.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
+ django_bulk_hooks-0.1.162.dist-info/RECORD,,